Eclipse > Java > open linked resources sources (.java instead of .class )?

前端 未结 4 2038
暗喜
暗喜 2020-12-03 22:35

I have 2 projects, A and B

project B have in his build path > libraries the class folder of A (Eclipse also recognized that there is a \"Source attachment\" and adde

相关标签:
4条回答
  • 2020-12-03 23:07

    Another case solution:

    One neat feature of Eclipse (and other IDEs) is that you can hold CTRL and click on a function or variable to go to its definition.

    A problem which may occur in Eclipse is that it opens the .class file (the compiled file) instead of opening the .java file when you do this. This is probably caused by the order of the entries in the .classpath file.

    Go to your project directory and open the .classpath file. Move all entires of type classpathentry with attribute kind="src" to the top of the file (or at least above any entries with kind "output").

    Restart Eclipse and the problem should be fixed.

    Found on this page

    0 讨论(0)
  • 2020-12-03 23:14

    Go to Project->Properties->Java Build Path.

    In Order and Export keep all the src files on top and selected.

    Eclipse will now pick .java over .class files

    0 讨论(0)
  • 2020-12-03 23:25

    You can use Ctrl+Shift+T to open a search Dialog.

    But you should add B as a dependent project of A (and remove it from the classpath).

    enter image description here

    0 讨论(0)
  • 2020-12-03 23:26

    Remove project A from "build path > libraries" and put it in "build path > projects".

    0 讨论(0)
提交回复
热议问题