284

Where can I change the default workspace in Eclipse?

3
  • 6
    "default working directory" = "default workspace"? Or something else? Commented Mar 3, 2011 at 10:19
  • 8
    do you mean "File\Switch workspace" menu? Commented Mar 3, 2011 at 10:25
  • 5
    If this question is about Java current working directory (CWD) in code, with respect to running in Eclipse, want to point out that our may have come across an interesting behavior. Using Eclipse with Subclipse to import a project to workspace, the CWD may be different than just importing a Java source project from disk (checked out elsewhere via external SVN tool). I haven't looked into this further yet, but just a heads up.
    – David
    Commented Dec 4, 2012 at 2:13

15 Answers 15

331

If you mean "change workspace" go to File -> Switch Workspace

5
  • 1
    It doesnt allow me to move this folder anywhere outside of my working folder...Is there any workarounds to move this folder into another drive?
    – Laserson
    Commented Mar 17, 2013 at 14:43
  • 25
    This doesn't answer the question, assuming the original question mentioned "default workspace". To change what Eclipse defaults to on startup, see the other answer.
    – Jon Coombs
    Commented Dec 9, 2014 at 0:39
  • Hi, what should I do if want to change the root directory of eclipse (for file handing in java)? Commented Aug 3, 2018 at 13:59
  • This is wrong answer. The question was about DEFAULT workspace and not how to switch workspace. How this answer got so many upvotes and green mark?
    – horvoje
    Commented Jan 24, 2022 at 9:57
  • As others pointed out, this is the wrong answer as it does not address setting the default. Commented Sep 9, 2022 at 11:53
194

I took this question to mean how can you change the Default workspace so that when Eclipse boots up the workspace you want is automatically loaded:

  • Go under preferences then type "workspace" in the search box provided to filter the list. Alternatively you can go to General>Startup and Shutdown>Workspaces.
  • There you can set a flag to make Eclipse prompt you to select a workspace at startup by checking the "Prompt for workspace at startup" checkbox.
  • You can set the number of previous workspaces to remember also. Finally there is a list of recent workspaces. If you just remove all but the one you want Eclipse will automatically startup with that workspace.
3
  • 12
    This clearly seems to answer the question better. At least, that's how I read it (and it's the question I needed answering when I searched and found this topic).
    – Jon Coombs
    Commented Dec 9, 2014 at 0:48
  • 1
    Preferences are under the "Window" menu in my version of Eclipse Commented Apr 7, 2016 at 16:17
  • 1
    Just what I was looking for. +1 Commented Jan 22, 2021 at 21:54
96
  1. Go to eclipse\configuration\
  2. Open the file "config.ini"
  3. Modify the line

    osgi.instance.area.default="F:/Workspace/Java"
    

    where "F:/Workspace/Java" should be your default workspace!

6
  • 2
    Take care with blackslashes in Windows implementations. Your windows path would be F:\Workspace\Java not the required F:/Workspace/Java. In Kepler there is no need of the quotes, I don't know about other versions.
    – Michael
    Commented Jul 5, 2013 at 10:48
  • 3
    Example on Mac Os X : [email protected]/Documents/workspace Commented Nov 2, 2013 at 10:10
  • 4
    As Michael said, use backslashes on windows. Also, not single but double. For eg., above director would be: "F:\\Workspace\\Java" Commented Jan 6, 2014 at 18:54
  • 1
    On ubuntu I went to ~/.eclipse/org.eclipse.platform_4.3.0_1473617060_linux_gtk_x86_64/configuration/config.ini and added this line [email protected]/workspace pointing it to where ever i wanted.
    – Jerinaw
    Commented Feb 7, 2014 at 18:41
  • 2
    @KhuljaSimSim - in fact for Windows foward slash works fine... eg. F:/eclipse/ worked fine for me.... and note - without the double quotes - just osgi.instance.area.default=F:/eclipse/
    – tom
    Commented Sep 9, 2015 at 14:35
28

If you are talking about changing the working directory for a java program that you launch from within eclipse, then there's a space for that in the run configuration. If you go to Run menu and select "Run Configurations..." then select your run configuration, then on the "Arguments" tab for a Java Application there is a place for you to edit the "Working directory". This alters the current directory that will be used for launching the java program.

See related question Default eclipse working directory if this is what you are meaning.

21

Whatever Frank has suggested to change in config.ini is correct. In case, if that didn't help, you need to remove path from recent workspace as below.

  1. Go to eclipse\configuration\org.eclipse.ui.ide.prefs\
  2. Open the file "org.eclipse.ui.ide.prefs"
  3. Remove the first path in RECENT_WORKSPACES.

    MAX_RECENT_WORKSPACES=5 RECENT_WORKSPACES=/Users/wrokspace1\n/Users/wrokspace2\n/Users/wrokspace3\n/Users/wrokspace4 RECENT_WORKSPACES_PROTOCOL=3
    SHOW_WORKSPACE_SELECTION_DIALOG=false
    eclipse.preferences.version=1

2
  • Issue I had was eclipse crashed before loading my workspace, and I had previously checked the 'use this as the default and do not ask again'. Changing SHOW_WORKSPACE_SELECTION_DIALOG=false to =true allowed me to select a workspace. Commented Nov 17, 2014 at 14:53
  • 5
    In Eclipse Neon the file is located at eclipse\configuration\.settings folder.
    – Genhis
    Commented Feb 14, 2017 at 20:58
8

File > Switch workspace > add the workspace you like > Eclipse will restart using the workspace you wanted.

3
  • 2
    why does eclipse restart when you change workspaces? What is the purpose?
    – Vass
    Commented Feb 5, 2012 at 11:56
  • 3
    I guess so that it loads all the information from the new workspace... but that's only my guess ;)
    – Neets
    Commented Feb 6, 2012 at 7:38
  • with diffrent workspaces more than one people can save is own configuration or even for your self if you want workspace to load with specific projects and libraries Commented Aug 11, 2013 at 18:40
6

If you mean to change the directory in which the program execution will occur, go to "Run configurations" in the Run tab.

Then select your project and go to the "Arguments" tab, you can change the directory there. By default it is the root directory of your project.

5

Open a command prompt. Change to the eclipse home directory and type "eclipse -clean" e.g. C:/eclipse>eclipse -clean

This will ask for the workspace selection. It will also force to set it as the default workspace.

Then, go to eclipsehome-->configuration-->settings folder.

open org.eclipse.ui.de.prefs in a notepad.

set this property to true from false.

SHOW_WORKSPACE_SELECTION_DIALOG=true

You will be asked for a workspace selection everytime.

1
  • This is what you need when Eclipse is broken, won't start with clean, other info isn't helpful (e.g. [email protected]/workspace). Thanks! Commented Oct 13, 2013 at 2:35
4

If you want to change recent workspace manually in a configurationfile org.eclipse.ui.ide.prefs exists in

eclipse > configuration > .settings > org.eclipse.ui.ide.prefs

open this file in an editor find RECENT_WORKSPACES in line #2 and in this line you can see recent workspaces and can change or even remove them.

1

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

1
  • This is wrong answer. The question was about DEFAULT workspace and not how to switch workspace.
    – horvoje
    Commented Jan 24, 2022 at 9:58
1

This is the only answer you got first when you search for default workspace, but any solution is not solved my problem, So I follow this step for a default workspace:

  1. First copy shortcut icon for your eclipse.
  2. Right click and go to properties, add your workspace path with -data attribute,

In Target:

D:\eclipse_path\eclipse.exe -clean -data D:\workspace_path\workspace

enter image description here

For using the same shortcuts and preference into this workspace, Export general --> preference from your working eclipse, it will generate one .epf file.

So, just import .epf file into your new workspace, and you are done.

enter image description here

1
  • 1
    -data option provided to the eclipse executable has helped me too. Thank for sharing. Commented Sep 11, 2019 at 6:03
0

If you want to create a new workspace - simply enter a new path in the textfield at the "select workspace" dialog. Eclipse will create a new workspace at that location and switch to it.

0

On Ubuntu I went to

~/.eclipse/org.eclipse.platform_4.3.0_1473617060_linux_gtk_x86_64/configuration/config.ini 

and added this line at the bottom

[email protected]/workspace

and changed workspace to the dir path from my home to where I put my workspace.

I combined @Frank answer with @Ronan Quillevere's comment

0

My kepler eclipse went into not responding at boot (shortly after installing GAE support) which I traced to a corrupt workspace. I fixed this by closing kepler, renaming the workspace directory (in use) so kepler starts normally without a workspace, then used file >> switch workspace to generate new workspace. Then started populating that with my old projects that I still needed.

-1

You can check the option that shows up when you start eclipse. Please see the figure below

enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.