167

Is there a way to tell what is the current Eclipse workspace you are currently working on?

Lii
  • 11,553
  • 8
  • 64
  • 88
jantox
  • 2,185
  • 4
  • 21
  • 22

25 Answers25

114

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.

marcinj
  • 48,511
  • 9
  • 79
  • 100
  • 1
    The problem is, if you have several workspaces, you have to keep track of which where there before... – ivant Oct 06 '12 at 12:21
  • 18
    Actually, this shows the last workspace that was closed, **not** the current workspace. If you are opening and closing several, this is not dependable. – Matt__C Jul 03 '13 at 13:33
  • 1
    @Matt__C The step provided in this answer will not show a list. It will show just one highlighted `Workspace` in the field. That one highlighted workspace defaults to your one and only current workspace. You can change the field to something different by typing in the field or using the browse button. But the field (`after clicking other`) as provided in this answer will show you your current workspace. I just tested it by typing in the field and creating a new test workspace. It changed to that workspace which has never been closed. That is what is now displayed in that field. – L. D. James Dec 20 '15 at 14:42
  • 1
    It appears that this was fixed at some point since I posted the comment in '13 and it now shows the current workspace. I still prefer the answer from @gridDragon since you just have to look at the title bar to see what workspace you are in. – Matt__C Dec 21 '15 at 16:28
84

start eclipse with -showlocation

Here are two interesting posts about it:

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

eclipse-startup-options-showlocation

Jonah Graham
  • 7,890
  • 23
  • 55
pgras
  • 12,614
  • 4
  • 38
  • 46
  • 12
    +1 for `-showlocation` that can also be added to your eclipse.ini as mentioned in one of the links – Brad Oct 12 '12 at 09:54
  • 4
    Adding -showworkspace in the eclipse.ini file helped me. It should be added before the -vmargs line though. – Zeus Sep 30 '13 at 14:11
  • 1
    Honestly this is much better than the accepted answer. – JRSofty Mar 25 '14 at 07:16
  • Another external link with more option details: http://eclipse.dzone.com/articles/show-workspace-location-title – cellepo Jan 08 '15 at 23:55
  • 1
    The most elegant solution to the problem. If anyone wonders, the path to the workspace will show up in the window bar. – Magnilex Feb 05 '15 at 13:59
  • This answer has two problems: 1) it shows the workspace location (path) not just the name, and 2) it puts the path on the right side of the title which means it won't show up in the taskbar. There's a better answer which puts the workspace name on the left side of the title bar: http://stackoverflow.com/a/11887008/564626 – jfritz42 Jun 27 '16 at 21:22
  • Worked for me in Eclipse Luna and Windows 10. Thanks. – Mandar Pandit Feb 22 '18 at 05:34
69

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.

GridDragon
  • 2,857
  • 2
  • 33
  • 41
  • Note that this applies only to newer versions of eclipse. In 3.5 (our corporate RTC client) it is not available. – Pierre Sep 13 '13 at 18:10
  • 7
    Wow. While this theoretically is a nice solution, it's insane that you need to put a custom string in there instead of Eclipse just using the workspace directory name by default. – sschuberth Nov 26 '13 at 08:44
  • 1
    Of all the solutions, this seems the least painful one - no modded start up script, no menu checks, etc. Then again it should be simple to write a small plugin to tweak the window title to show the workspace folder name unless it is set in the above mentioned preference. Fortunately, my workspaces aren't that dynamic; for others it may not be the case. – Frelling Nov 21 '14 at 15:31
  • I'm using eclipse Indigo, and it's not there! :( – Dr.jacky Feb 09 '15 at 13:27
  • For Eclipse 4.5 and later, it's no longer necessary to assign a custom string. In 4.5 the workspace path itself is shown in the preference page. See later answer by @ROMANIA . – Andy Thomas Oct 27 '16 at 22:06
21

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 Preferences General 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.

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
16

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.

Gwenc37
  • 2,064
  • 7
  • 18
  • 22
user3611642
  • 261
  • 3
  • 5
12

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.

Andreas Dolk
  • 113,398
  • 19
  • 180
  • 268
  • 1
    Since you can have resource outside of your workspace the path before the name of the project is not always your workspace path. – K Erlandsson Dec 02 '10 at 09:02
  • @Kristoffer - we can created "linked" projects? I know that this is possible for files and folders, but for projects too? I'll edit my answer. – Andreas Dolk Dec 02 '10 at 09:54
6

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.

Kelly S. French
  • 12,198
  • 10
  • 63
  • 93
5

Summary:
(from most immediate to lesser (but more elegant), leaving out redundant ones)

  1. File > Switch
    File->Switch Workspace->Other... -> full answer
  2. Help > About
    Help -> About Eclipse -> Installation Details -> Configuration: osgi.instance.area ->full answer
  3. Title bar (start-up parameter)
    If you start eclipse with -showlocation -> full answer
  4. Title bar (naming workspaces)
    Give each workspace a name -> full answer
Community
  • 1
  • 1
e-motiv
  • 5,795
  • 5
  • 27
  • 28
2
  1. Go to File->Switch Workspace.
  2. You can see a list of workspaces excluding your current workspace.
  3. Now go to the physical location and see which one is missing in the list.

The missing one is your current workspace.

Perception
  • 79,279
  • 19
  • 185
  • 195
sandeep
  • 21
  • 1
2

http://mcuoneclipse.com/2012/08/01/show-workspace-location-in-the-title-bar/

http://www.rekk.de/bloggy/2007/eclipse-show-workspace-location-in-title-bar/

add -showlocation to your shortcut.

c:\eclipse\eclipse.exe -showlocation

Sri
  • 87
  • 1
  • 2
  • 10
2

I just found my current Workspace with Simplest Way.

Step 1:

Start Your Eclipse (If default workspace is set, Eclipse never ask for Choose workspace OR it will set to path which we have used last time)

Step 2:

When Eclipse start Completely, try to Start Eclipse again with same shortcut/exe file. It will show you below error message and you will get your default/current workspace

enter image description here

Jubin Patel
  • 1,959
  • 19
  • 38
2

Check the path of any resource in the resource's properties. Then you'll know. OR: Go to Preferences > General > Workspace and add a Workspace name (shown in window title)

Lukas Eder
  • 211,314
  • 129
  • 689
  • 1,509
2

Use the switch workspace from the file menu and you will know it

Aravind
  • 2,188
  • 4
  • 24
  • 28
  • 3
    You have to do File->Switch Workspace->Other..., and the current workspace should be highlighted. Otherwise it just shows you a list of workspaces that aren't the one you're in (process of elimination?). – Ogre Psalm33 Jun 28 '11 at 18:45
2

start eclipse with -data

example: c:\eclipse\eclipse.exe -data c:\workspaces\myWorkspace1

ingo
  • 21
  • 1
2

-showlocation is great, but it only changes the text at the end of the title bar, so it's often not visible in the taskbar.

If you want to change the beginning of the title bar, which shows the current Perspective, you can use Window -> Save Perspective As... and the new title will be visible in the Taskbar.

Dave L.
  • 43,907
  • 11
  • 63
  • 62
  • I like that you want the workspace name to show up on the left, but this is kind of a hack that's misusing the Perspective feature. There's another answer that does it in a better way: http://stackoverflow.com/a/11887008/564626 – jfritz42 Jun 27 '16 at 21:20
1

I created an External Tool Launch Configuration containing the following (exported echo-workspace.launch file content):

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration
    type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
    <listAttribute key="org.eclipse.debug.ui.favoriteGroups">
        <listEntry value="org.eclipse.ui.externaltools.launchGroup" />
    </listAttribute>
    <stringAttribute key="org.eclipse.ui.externaltools.ATTR_LAUNCH_CONFIGURATION_BUILD_SCOPE" value="${none}" />
    <stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="c:\Windows\System32\cmd.exe" />
    <stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="/c echo &quot;${workspace_loc}&quot;" />
</launchConfiguration>

So that the workspace folder path is echoed in the console.

Feel free to copy this into a .launch file and import it into Eclipse: File > Import ... > Run/Debug > Launch Configurations

I'll figure out a Mac/UNIX version soon, as I was on Indigo/Win when I made this one.

RobertHana
  • 11
  • 2
1

You will often have to use multiple running Eclipse instances at a time. To switch between them, it's helpful to set a name for the workspace that is displayed in the title of the Eclipse window. To do this, open Window/Preferences. In the Preferences window navigate to General/Workspace and give every workspace an individual workspace name.

Manglesh
  • 520
  • 1
  • 13
  • 29
1

I got into a situation which caused eclipse startup to fail completely due to workspace corruption.

(Similar to Eclipse won't start, log error says: ObjectNotFoundException: Tree element)

It had been so long since i used eclipse that i forgot where my workspace was. This is where i found the setting.

~$ grep osgi.instance.area.default eclipse/configuration/config.ini osgi.instance.area.default=@user.home/Documents/workspace

Community
  • 1
  • 1
Declan Shanaghy
  • 2,314
  • 2
  • 18
  • 19
1

If you want to find the path programatically, use this:

ResourcesPlugin.getWorkspace().getRoot().getLocation().toString();
Pang
  • 9,564
  • 146
  • 81
  • 122
zookastos
  • 917
  • 10
  • 37
1

File -> Switch Workspace

Daniel Engmann
  • 2,840
  • 1
  • 23
  • 17
1

If you want to switch wokspace, then File->Switch Workspace. Click "Other" and choose appropriate folder. Is that what you want? :)

JohnGray
  • 656
  • 1
  • 10
  • 27
0

Simple Logic...

Just Click on File menu then Switch Work Place

Click on Other

Then the dialogue pops up with current workspace highlighted on the top of the list. If you click on this list, other workplaces are shown.

Community
  • 1
  • 1
0

clicking File->Switch Workspace gives the wrong result on my system.
This method gives the correct result:
File -> Properties -> Resource
now check the path in the third line labeled "location" in window labeled Resource
It will show the workspace folder just before the project folder.

ajay1865
  • 61
  • 2
0

windnow -> preference -> General -> startup and shutdown -> workspaces - top one will be your current workspace.

neeraj t
  • 4,654
  • 2
  • 27
  • 30
0
  1. Go to Window -> Preferences.
  2. Search for Workspaces & select.
  3. The top one is your current workspace.
Suresh
  • 134
  • 5
  • 14