开发者

In a big Java project can not locate .java file belonging to a package using eclipse

I'm new to java with a C++ background. I'm using Eclipse and have imported projects created by maven using "mvn eclipse:eclipse". In eclipse, when I highlight a class name from another class and do "Open Declaration", eclipse would normally open the corresponding .java file.

However, for one of the classes, eclipse "Open Declaration" opens up a .class file which shows all the context of the file. However, this file is not editable. Furthermore, I can't locate the actual .java file behind it. There is a package line in the beginning of the .class file and it points to a directory that doesn't seem exist. I believe there is a way to trace b开发者_JAVA技巧ack to the original .java file from the .class file but I'm not sure how to do this. Please help.


The class is likely in one of your dependency jars, so you don't have the source locally in a project. Many maven published projects allow for the source to be downloaded in a jar, and eclipse can use that to display the source, but editing it would be meaningless in that instance.

If you hit ctrl+shift+T and search for the class you should be able to see the location of the class in the bottom portion of the "open type" dialog.

In the eclipse "properties" for the jar that contains the class, you should be able to set the "Java Source Attachment" to the folder on your system that contains the source (if you have it)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜