[英]How to see the source code for java SDK (java.lang, java.util, …) classes in Eclipse?
I want to read jar class files into my eclipse. 我想将jar类文件读入我的日食。 Suppose I wrote the following code:
假设我编写了以下代码:
List list = new ArrayList();
When I ctrl click on List, it shows two options. 当我按Ctrl键单击“列表”时,它显示两个选项。 One of the option is Open Declaration which will show the methods in List interfaces.
选项之一是“打开声明”,它将在List接口中显示方法。 But when I click it it shows source not found.
但是,当我单击它时,它显示找不到源。 I've added
java-util-1.8.0.jar
to it but still it won't work. 我已经将
java-util-1.8.0.jar
添加到了它,但仍然无法正常工作。 What am I doing wrong? 我究竟做错了什么?
you have to add Eclipse Plugin from 您必须从添加Eclipse插件
HELP -> Eclipse Marketplace 帮助-> Eclipse Marketplace
I personally used 我个人使用
Enhanced Class Decompiler 增强的类反编译器
just install it. 只需安装它。 and have fun.
玩得开心。
In order to see the source codes of JDK
in eclipse you should add JDK
path instead of JRE
to your workspace or for a specific project SDK. 为了在Eclipse中查看
JDK
的源代码,应将JDK
路径而不是JRE
添加到工作区或特定的项目SDK。 I assume you are a developer and you've installed JDK
on your system. 我假设您是一名开发人员,并且已在系统上安装了
JDK
。
To do that: 要做到这一点:
JRE
location to points to the JDK
location in your file system. JRE
位置指向文件系统中JDK
位置的路径。 Hope this would be helpful. 希望这会有所帮助。
See if you have a src.zip file in your JDK Home. 查看您的JDK主页中是否有src.zip文件。 This would contain the source code for all Java SE libraries.
这将包含所有Java SE库的源代码。 Just unzip and browse the Java files to view the source code.
只需解压缩并浏览Java文件即可查看源代码。
If you want to debug through the source files then follow the instructions of attaching source folder in Eclipse as mentioned above. 如果要调试源文件,请按照上述在Eclipse中附加源文件夹的说明进行操作。
Assuming you project is Maven one.Go the Project --> Right Click --> Maven -->Download Javadoc & sources. 假设您的项目是Maven,请转到项目->右键单击-> Maven->下载Javadoc和源代码。 After performing these steps your problem will be resolved.
执行完这些步骤后,您的问题将得到解决。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.