Java 找不到源:添加源附件以查看源代码
我无法查看JavaCore.class源代码,尽管我可以很好地使用这些代码 例如,要查看方法Java 找不到源:添加源附件以查看源代码,java,eclipse,Java,Eclipse,我无法查看JavaCore.class源代码,尽管我可以很好地使用这些代码 例如,要查看方法JavaCore.create(..)的源代码,我在JavaCore.create(ResourceUtility.getWorkspaceRoot())中的create上单击(或按f3)。但我得到的信息不是源代码编辑器,而是: **Class File Editor** **Source Not Found** The source attachment does not contain the s
JavaCore.create(..)
的源代码,我在JavaCore.create(ResourceUtility.getWorkspaceRoot())中的create
上单击(或按f3
)代码>。但我得到的信息不是源代码编辑器,而是:
**Class File Editor**
**Source Not Found**
The source attachment does not contain the source for the file JavaCore.class.
You can change the source attachment by clicking Change Attached Source below:
我列出了默认源附件~/.eclipse/org.eclipse.platform_4.3.0_758590624_linux_gtk_x86_64/plugins/org.eclipse.jdt.core_3.9.0.201216161923.jar
,如下所示:
`jar tvf ~/.eclipse/org.eclipse.platform_4.3.0_758590624_linux_gtk_x86_64/plugins/org.eclipse.jdt.core_3.9.0.201212161923.jar `
当我在输出中搜索“JavaCore”时,我只找到以下文件:
618 Sun Dec 16 19:23:18 PST 2012 org/eclipse/jdt/core/JavaCore$1.class
1746 Sun Dec 16 19:23:18 PST 2012 org/eclipse/jdt/core/JavaCore$2.class
66406 Sun Dec 16 19:23:18 PST 2012 org/eclipse/jdt/core/JavaCore.class
1758 Sun Dec 16 19:23:18 PST 2012 org/eclipse/jdt/core/JavaCore.java.rej
这是否意味着我在这个jar下没有源代码?如果没有,源代码会在哪里
我正在使用Ubuntu13.10(Saucy Salamander),我在~/Eclipse/
下安装了Eclipse(其中包含我的插件/
、dropins/
等)。我猜您需要从SDK获取JDT源代码。如果您的Eclipse版本是4.3.0,那么您可以从以下位置获取JDT SDK:
我在Eclipse 4.3.0的归档页面上找到了以下内容:
编辑:下载zip文件后,您需要的文件是plugins/org.eclipse.jdt.core.source\u 3.9.0.v20130604-1421.jar
(尽管文件上的日期戳与二进制文件不同…对于本例,我在~/eclipse/plugins/org.eclipse.jdt.core.source\u 3.9.1.v20130905-0837.jar
下找到了源代码。我不知道为什么Eclipse在~/Eclipse/plugins/
下有许多源代码“.jar”时,会默认为源代码的~/.Eclipse/
目录 谢谢!但是我的~/eclipse/plugins/org.eclipse.jdt.core.source_3.9.0.v20130604-1421.jar
目录下已经有了这个文件。您知道为什么Eclipse自己找不到文件位置吗?(下面是我的答案)啊,我应该先检查一下:)不确定-您是否通过引用plugins目录下的外部jar在项目中显式地将jar作为库加载?如果是这样的话,那么你就需要像通常那样为这样的库附加源代码。据我所知,我没有。尽管我想知道为什么我有两个eclipse安装—一个在~/eclipse
下,另一个在~/.eclipse
下。我是从~/eclipse/eclipse
启动的,因此我的文件引用~/.eclipse/plugins
目录是没有意义的。我想知道我的~/.eclipse
目录的目的是什么?我应该删除它吗?