37

If I've got a file open in Eclipse, how can I figure out where it is on the filesystem?

For example, in Vim I would use :pwd.

David Wolever
  • 148,955
  • 89
  • 346
  • 502
  • In NetBeans, you just hold your cursor over the file name in the tab row and the full path appears as a tooltip. I don't have Eclipse handy, though. – Michael Myers Nov 10 '09 at 20:37
  • 1
    @DavidWolever No, it doesn't :) It shows path relative to project's root not a filesystem's path. – Piotr Dobrogost Oct 18 '11 at 15:25

6 Answers6

53

Use the Eclipse menu:

File->Properties

or the shortcut:

Alt-Enter

You should be able to see the Location associated with the Resource

  • 7
    I have open what looks like a .class file, and I'm trying to find where it's from - both of these methods just elicit a dialog saying "No property pages for ." – Erhannis Dec 19 '16 at 23:30
12

Just hit Alt-Enter.

tangens
  • 39,095
  • 19
  • 120
  • 139
5

The other solution ("File-->Properties" or "Alt+Enter") didn't work for me.

I use:

  • Right Click (in current editor) --> Show In (shortcut: Alt+Shift+W) --> Project Explorer

This shows in Project Explorer the location of the file. If the file is a class in a referenced library, the dependency tree is automatically opened.

CT Liv
  • 319
  • 2
  • 6
  • You can also use the "Link Editor" button (opposing arrows) in the Project Explorer. You probably want to toggle it off afterwards otherwise subsequent files will be open too. – Huntro Nov 22 '18 at 09:09
3

Eclipse also has the ability to link the explorer view with the current file, so that whenever you change a file, it is expanded and selected in the explorer view.

Just look for the following image at the top of the view: alt text

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Topher Fangio
  • 20,372
  • 15
  • 61
  • 94
3

What you're looking for is the 'Properties' dialogue for the current file. This can be activated in two ways:

  • Selecting from the menu: File -> Properties
  • Using the shortcut: Alt + Enter

This gives you a dialogue which contains both the full path of the document, as well as the relative path from the workspace root.

The dialogue can be quite handy: it allows you to highlight and copy the file path.

Grundlefleck
  • 124,925
  • 25
  • 94
  • 111
2

Linking to Project Explorer won't work if you have many files - it will select the right file in the list, but it won't "scroll" to that portion so it is visible.

You'd have to manual scroll the Project Explorer view to see where the file is. It could also be nested so deeply that the full location will be obscured by truncation.

Another way to quickly (keyboard-free) see the path is to hover over the file type icon (on top of the open editor window).

mr.maga
  • 91
  • 1
  • 3
  • Hovering over doesn't show full path. It shows half path. Such a pity of Eclipse. File-Properties shows it. – Atul Jun 15 '22 at 09:05