How to find the origin of a file shown in Eclipse editor
In eclipse you can open a class by clicking on outp开发者_开发问答ut of a stacktrace or by "opening a declaration".
How can I find the location of the file on disk, or the jar file from which it was loaded?
The easiest way, if you already have the source open, is to use the menu item "Navigate > Show In > Project Explorer". This will highlight the package. Then:
- If it is within a jar file, just navigate up the tree and you should see the location after the jar filename.
- If the source file is in your workspace, you should be able to get full information from the file properties (right click in Explorer and select Properties, or select the Properties menu item on the File menu). This should give you the location on disk, and even the location in your revision control system, if you have eclipse integration for it.
To locate a jar:
- Find a method call to the jar in question (e.g., Transport.send). Highlight the call
- Press F3 to open declaration.
- If this is not your jar, you will get a "Source not found" message, and it will name the jar (e.g., "the JAR file mailapi.jar has no source attachment").
- Go to the Eclipse menu: Navigate -> Open Resource. Enter the name found in the previous step.
- Press Open or note the package open the bottom with the location.
To find where a file is located on disk:
- Bring up the file in the Package Explorer (one of the tabs on the Java perspective)
- Drill down to the file you are interested in.
- Right-click -> Properties
- You will see the disk location when you click on Resource.
One of the Eclipse plugin which I use add following context menu in the Project/Package Explorer and clicking on will open this file selected in Windows Explorer or Finder in case of Mac.
Following is the update site for this Eclipse plugin:
http://show-file-on-disk.googlecode.com/svn/trunk/site/v1/
More details can be found at following link: http://git-hemant.github.io/ShowFileOnDisk/
Disclaimer: I am the author of this plugin.
精彩评论