Eclipse: Get location of the current file?

后端 未结 6 1802
情深已故
情深已故 2021-02-03 20:44

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.

相关标签:
6条回答
  • 2021-02-03 21:02

    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).

    0 讨论(0)
  • 2021-02-03 21:07

    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.

    0 讨论(0)
  • 2021-02-03 21:12

    Use the Eclipse menu:

    File->Properties

    or the shortcut:

    Alt-Enter

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

    0 讨论(0)
  • 2021-02-03 21:12

    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:

    0 讨论(0)
  • 2021-02-03 21:17

    Just hit Alt-Enter.

    0 讨论(0)
  • 2021-02-03 21:17

    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.

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