Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

java

eclipse

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 added it.

Both A and B are in the same workspace.

When I Ctrl + click into a function of project A referenced into a file of B Eclipse open the .class file of A. But if I need to edit the .java version of that file I must manually look for the filename in project A and open it from project explorer.

There isn't an easier way to go from a linked resource to -> .java file of his source or to go from .class to .java in easier way than manually expand folders and open the file?

like image 666
Francesco Avatar asked Dec 22 '11 11:12

Francesco


2 Answers

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

like image 126
utkarshp Avatar answered Nov 09 '22 05:11

utkarshp


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

like image 33
oers Avatar answered Nov 09 '22 05:11

oers