Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tell Eclipse Workspace?

Tags:

java

eclipse

People also ask

What is the default Eclipse workspace?

Eclipse workspace is a directory which stores the projects and complete state of our IDE at a given time. The source code of project is by default saved in workspace. Eclipse always uses workspace to work. When we start eclipse, it starts with a default workspace which can be changed later.

Where are Eclipse workspaces stored?

eclipse stores all its workspace settings and files in the . metadata folder.

How do I select a workspace in Eclipse?

In Eclipse , go to File -> Switch Workspace , choose or create a new workspace.


For me it work to choose File->Switch Workspace->Other... and it shows the name of current workspace.


I tried to confirm

"Actually, this shows the last workspace that was closed, not the current workspace. If you are opening and closing several, this is not dependable."

and I am not able to reproduce it. Each time I get the currently loaded workspace (I was testing on Juno). I also checked sources and in ChooseWorkspaceDialog.java and ChooseWorkspaceData.java, and it looks like it manages simple list of last time opened workspaces which is stored as a RECENT_WORKSPACES key in org.eclipse.ui.ide.prefs file. The workspace name shown in this dialog is the first one from this list.


start eclipse with -showlocation

Here are two interesting posts about it:

top-10-tips-for-new-eclipse-users (archived version)

eclipse-startup-options-showlocation


Go Window>Preferences. Then under General>Workspace there is a property: "Workspace name (shown in window title)" and put in some sort of identifying label.

You'll need to set this up for each workspace you have, but it's an easy way to know which workspace you're in at a glance.


Eclipse Neon (4.6)

According to M7, workspace name is shown in window title by default.

Eclipse Mars (4.5)

Window > Preferences > General > Workspace

Window PreferencesGeneral Workspace

There is also a check box "Show workspace path in window title".
The result looks like this:
title bar

This feature is described here.


If any project exists in the workspace:

Select a project and its properties (e.g. Menu: Project -> Properties or right mouse button->Properties). Then go to Resource -> Linked Resources and the WORKSPACE_LOC's Path Variable value shows the current workspace path.


There's an environment variable called osgi.instance.area. You can find it via "Help -> About Eclipse -> Installation Details -> Configuration" (for eclipse "Helios" 3.6)

Or, open the properties of any project, then select "Resource". You'll find a "Location" property which is structured like this:

<path-to-current-workspace>/<name-of-current-project>

Note - the "erased" procedure works in most cases but can not be used in general, because a project folder does not have to be located in the workspace folder. You can choose external locations during project creation. So if you never uncheck the "Use default location", the procedure is save. The first procedure is reliable.


File->Properties

Select a file in the workspace and then use the menu: "File->Properties". A dialog pops up and should show the 'location' of the file. Read the location from right to left so you go through the class, package, folder, project, then you should see the workspace.