查看java源代码 [英] view java source code
问题描述
有没有办法查看Java中默认类背后的实际代码( java.awt。*;
, javax.swing。*;
等)看完全发生了什么?
Is any way to view the actual code behind the default classes in Java (java.awt.*;
, javax.swing.*;
, etc) to see exactly what it is that is happening?
我的意思不仅仅是文档,或方法列表等,但源代码本身详细(换句话说,如果复制并粘贴到Java程序的代码中,可用于创建整个方法/类的精确副本) 。
I don't mean just the documentation, or a list of methods, etc, but the source code itself in full detail (in other words, what could be used to create an exact copy of an entire method/class if copied and pasted into the code for a program in Java).
推荐答案
所有API类的Java源代码都在JDK安装程序中附带一个名为 src.zip
。它通常只是坐在您的安装目录中。解压缩,然后看看。
The Java source code for all the API classes is shipped in the JDK installer in a file named src.zip
. It's often just sitting in your install directory. Unzip it, and have a look.
如果它不存在,你可能选择不安装它;重新安装JDK并注意源代码选项,确保包含它。
If it's not there, you may have chosen not to install it; reinstall the JDK and watch for the "source code" option, making sure to include it.
这篇关于查看java源代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!