How to change the Eclipse default workspace? - eclipse

Where can I change the default workspace in Eclipse?

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

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.

Go to eclipse\configuration\
Open the file "config.ini"
Modify the line
osgi.instance.area.default="F:/Workspace/Java"
where "F:/Workspace/Java" should be your default workspace!

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.

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.
Go to eclipse\configuration\org.eclipse.ui.ide.prefs\
Open the file "org.eclipse.ui.ide.prefs"
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

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

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.

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.

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.

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

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:
First copy shortcut icon for your eclipse.
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
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.

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.

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
osgi.instance.area.default=#user.home/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

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.

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

Related

eclipse editing area is limited to top right area

Help!
My editing area of eclipse become very small, limited on the top right corner. While other areas are blank. Even if I try to maximize the editor (MainActivity.java), it is still limited at the top right corner, leaving other areas as blank.
I never encountered this problem before. Does anyone know how to restore to the default settings?
Thank you!!!
From the Window menu, Reset Perspective
The Eclipse IDE has both workspace specific settings and generic IDE
settings.
The workspace settings are saved inside the workspace folder which is
specified when Eclipse starts up the first time. These settings are
saved in a folder called '.metadata' inside the workspace location.
You can change the location of the workspace in Eclipse by using the
'File' menu and then clicking on the 'Switch Workspace' option.
Note: If you delete your workspace folder you will also delete
projects located inside this folder. If you wish to preserve your
projects only delete the '.metadata' directory.
Eclipse will save all the non workspace specific settings in a
different location. This will depend on whether you are using a Linux
or Windows environment.
Windows*: C:\Documents and Settings\\Application Data\ARM\ARM
Workbench IDE Linux: /home//.awide
You can safely delete the configuration folder to force Eclipse to
start up using the default settings. Eclipse will re-create the
configuration folder with all the configuration files.
*For Windows 7 users: the C:\Documents and Settings\\Application Data... directory has moved to C:\Users\\AppData...
from here

Eclipse opens blank workspace

I have this weird issue where the following happens:
fresh eclipse juno install (with all updates applied)
works fine for a while asking which workspace I want to open with a dialog on startup
after a few days it stops prompting me for workspace, opens blank made up workspace instead in /Users/myself/Documents
If I check "preferences -> workspace -> startup and shutdown" everything seems fine, the only workspace in the list is the one I created and the checkbox that says "don't prompt for workspace" is not checked.
This happened a few times already on fresh eclipse installations and fresh hard drives (same machine but I replaced the hard drive, re-installed OS and everything for other reasons and now it happened again).
I am on:
OSX 10.7.5
Eclipse Juno (Service release 2)
Any help appreciated!
I have exactly the same problem on OSX, for no reason, one fine day, Eclipse will start-up with a new blank workspace!
And to all the stupid answers and responders out there: YES I know how to set and select a default workspace! And NO creating a new workspace, re-importing lots of projects and loosing all my 30+ database connections under my Toad Extension, is not an option.
What I found is that
For some reason Eclipse creates a directory /Users/user_name/Documents/workspace which is the blank workspace it starts-up with (incorrectly)
My usual workspace is under /Users/user_name/Documents/Development/eclipse
The solution is (this is on Mac OSX, don't know if it is the same on Windows):
Goto your Eclipse directory where you run Eclipse from (mine is /Applications/eclipse)
In {eclipse_dir}/configuration open the file config.ini
Find the line osgi.instance.area.default=#user.home/... and confirm that it is pointing to the bogus workspace directory.
Modify the path of this entry to point to the correct workspace
Save the config.ini file.
Try starting Eclipse and it should open your workspace now.
If your Eclipse get stuck loading plugins now, goto your workspace directory and look for the .metadata directory (its hidden). Inside the .metadata directory, remove the .mylyn directory and restart Eclipse.
Once Eclipse started with the correct workspace loaded, do a proper Eclipse shutdown to ensure your workspace is closed and saved properly.
This worked for Eclipse Juno.
Hope this helps!
Just running this command helped me
eclipse.exe -data C:\Development\Eclipse\Workspace
FYI this happens due to install of some plugins.
This same problem happened to me on Windows on two separate Eclipse installations, without installing any plugin.
I was able to get my working Workspace by clicking on File > Switch Workspace, but closing and opening Eclipse again would reset it to a default Workspace.
What apparently solved this was to force Eclipse to save Workspace settings by ticking the Prompt for workspace on startup setting in General > Startup and Shutdown > Workspaces, which I had turned off.
The next time Eclipse opened, it asked me for the Workspace, and it had my correct one first in the list. I asked not to be prompted again for it and now it opens the right workspace when I launch Eclipse once again.
I solved this problem as per JJ-za's answer, except steps 2 and 3:
In {eclipse_dir}/configuration/.settings open the file org.eclipse.ui.ide.prefs (when Eclipse is not running)
Find the line RECENT_WORKSPACES= and confirm that the workspace is pointing to the correct workspace directory and that multiple workspaces are separated by \n

How to force Eclipse to ask for default workspace?

I noticed that after installing cdt, Eclipse always loads the default workspace. The workspace listed in the config.ini in osgi.instance.area.default. Eclipse does not ask which workspace to open regardless if Prompt for workspace on startup is set or not.
How do I force Eclipse to ask which workspace to load on startup?
It works for me if I tick the box Prompt for workspace on startup, which you can find in
Window → Preferences → General → Startup and Shutdown → Workspaces.
I had the same problem with indigo on linux 3.0 X86_64:
After runnning eclipse -clean everything went back to normal.
Thanks to some comment on the eclipse issue:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=134412
Inside the configuration/.settings folder of your Eclipse installation, there is a file called org.eclipse.ui.ide.prefs. Open this file in a text editor and change the property SHOW_WORKSPACE_SELECTION_DIALOG from false to true.
Tested with Eclipse 3.7 on Windows.
Using Eclipse Indigo this is how I did it:
Window → Preferences → Startup and Shutdown → Workspaces
Check the box at the top of the window that says "Prompt for workspace on startup"
The “Prompt for workspace at startup” checkbox did not working.
You can setting default workspace, Look for the folder named “configuration” in the Eclipse installation directory, and open up the “config.ini” file.
You’ll edit the "osgi.instance.area.default" to supply your desired default workspace.
Version: Eclipse CIndigo Service Release 2
File > Switch Workspace > Other...
In the textbox, write the path in the Workspace or Browse
It automatically sets the default Workspace during exit.
I followed the thread and tired all things but didn't work. Finally I saw that my eclipse shortcut target is like below
C:\Eclipse_3.6\eclipse\eclipse.exe -clean -data "C:\workplace" ...
I simply removed -data option and it worked. Now I got popup to choose workspace at startup.
cheers.
I had the same issue (in Eclipse Juno), but I just wanted to change the default workspace to the one I'm using
There's a setting in ECLIPSE_DIRECTORY/configuration/config.ini that is causing a specific workspace to be loaded without prompting for a workspace. If you just want to change the default workspace, you can just modify the value or add it if it doesn't exist:
osgi.instance.area.default=#user.home/some_workspace
or
osgi.instance.area.default=/some/absolute/path/some_workspace
Starting eclipse with eclipse -clean did wonders for me.
I can confirm that I am having the same issue. I am also using Eclipse classic with CDT. The funny thing is that it only started happening earlier this evening. Before then, I was always prompted for the workspace. Checking Prompt for workspace on startup has no effect. I am not launching eclipse using a startup script, so the -data flag is not set on launch. I have removed the line osgi.instance.area.default from the configuration/config.ini file, but that had no effect.
A few strange quirks that are incidental to this problem: If I delete the workspace workspace it creates it again upon launch. However, when I switch to one of my "real" workspaces I notice that the workspace workspace is not listed as an option to be switched to.
As would be expected, reinstalling Eclipse resolves the issue. But it would be nicer to find a way to fix the problem without resorting to that.
Under Aptana 3.2.2, in \configuration\.settings\org.eclipse.ui.ide.prefs, edit:
RECENT_WORKSPACES=I\:\\PDT\\workspace
It will check the recent workspace, so just set it to what you want. I do it for running off an external drive.
Editing the config.ini file with
osgi.instance.area.default=\D:\\Projects\\Eclipse Workspace\\
worked for me.
Sometimes you need to pay attention to howw Eclipse is launched. I ever pinned Eclipse by rigk-click on the excutable and pinning it to taskbar. In this way, the Eclipse is launched to use settings under c:\User\public\public Documents\eclipse" which is not very desirable.
However, if you pin it by creating a short-cut, then it will launch to use settings in the folder of Eclipse installation. Then everything makes much more sense.
I'd recommend you to create a shortcut to eclipse.exe with the -data command line option. This way you can create a separate shortcut to each workspace you use, and avoid unnecessary dialogs and mouse clicks.
Windows: Just create an Eclipse shortcut on your desktop, then right-click to open Properties and under Shortcut set something like this as Target: C:\eclipse\eclipse.exe -data C:\Path\to\your\workspace1. This will launch Eclipse and automatically open workspace1.
Repeat the steps for all the workspaces you use often.
I resolved the problem by adding the -showLocation flag to eclipse.ini.
I first tried the -clean option, but that didn't solve the problem. Then I added the -data option with the correct path to the workspace, which worked.
If your Eclipse is auto-closing at startup you can
Open the properties of your shortcut and add -clean at the end of the path,
Or, in a command prompt, run C:\PATH_TO_YOUR_ECLIPSE\eclipse -clean like mentioned in the comments and other answers
I had the same problem on my Eclipse, and calling eclipse -clean did not solve the problem.
In the end I figured out that within the installation folder of Eclipse there is a script called eclipse. This script does some setting of environment variables and then calls eclipse.bin. The call for eclipse.bin contained the this command-line switch:
-data ~/.eclipse
When I removed that switch from start-up script, I got the workspace selection as expected.
Go to Window → Preferences → General → Startup and Shutdown → Workspaces (or Eclipse → Preferences → ... on macOS)
Check the checkbox Prompt for workspace on startup
Then at startup Eclipse will ask for workspace selection.

eclipse workspace: how to rename workspace

There is no option in the file menu to rename a workspace. Is the recommended practice to close eclipse, rename the folder, and re-open? I worry about some potential dangling references in configuration files corrupting my workspace/projects...
Thanks!
Source : Renaming a workspace?
Yes, you can just rename the workspace
directory and/or move it. However, you
then have to tell Eclipse where the
new workspace is. In 3.1, you can use
'switch workspace' to launch in a
different location (under the File
menu).
If you want to change it by hand, you
can edit the appropriate entries in
the files in the 'configuration'
directory where Eclipse is stored.
You can change the
org.eclipse.ui.ide.prefs file to set
SHOW_WORKSPACE_SELECTION_DIALOG=true
if you want to be asked each time
Eclipse is run where the workspace is.
For simple renaming, it is not necessary to switch workspaces, unless the workspace you want to rename is not the one currently active.
Anyway, you can rename the current open workspace by choosing Eclipse->Preferences->General->Workspace and changing the option "Workspace name (shown in window title)" from the default's workspace folder name to whatever you want to call it. Then, restart Eclipse.
Suppose your workspace's folder is "/foo/bar/workspace" and you never changed its name before; its name was then the default "workspace". After you renamed it to, say, "my_workspace" and restarted Eclipse, the Eclipse's window title should show: "my_workspace - (some stuff that varies) - /foo/bar/workspace".
Note that this is NOT going to modify the workspace folder's name. You may have to create a new folder with the desired name, switch to that folder (whose workspace will have the same name, by default) and import existing projects into it, as some have suggested here.
Renaming Workspace folder worked for me. Close the eclipse, rename the workspace folder name, launch eclipse again. If you are using any project dependencies like user libraries,launchers etc, you have to relocate those to new location manually, from project build path.
Copying workspace to a new folder works. Any reference Eclipse itself needs is resolved using the relative workspace location. If you have added launchers, substitution variables, etc. that rely on the absolute workspace location, they will need to be reset.
John,
I think in the original workspace you imported projects and that the projects depend on links not on being physically in the same location of the worspace (even thay are there already but the dependency is on links). If so you have to remove the projects from the new (copied) worspace and then re-import them again.
I just did a:
File --> Import --> Maven --> Existing Maven Projects --> mention the new workspace location in "Root Directory" in the "Import Maven Projects" window
and it worked! All projects were imported properly.
BTW, I have Eclipse-Maven plugin "m2e" installed (http://wiki.eclipse.org/M2E_updatesite_and_gittags)
2021 Update
In Eclipse 2020-12 (Windows 10), the "Workspace name (shown in window title)" preference mentioned in one answer is no longer there. Now, renaming a workspace (WS) requires a copy and delete operation.
Start by switch to another WS: File --> Switch Workspace --> select existing WS. Then rename the WS folder to desired new name. Switch to the new workspace folder and delete the old name:
File --> Switch Workspace --> Other...
Right-click old WS name --> Remove from launcher selection
Click Browse --> select new workspace folder --> click Launch and Voila!
As mentioned in prior posts, depending on your setup some resource links may be broken. Delete the project without(!) removing it from disk, then import to new WS.

Where are projects stored in Eclipse?

The Project Explorer is able to list all projects in Eclipse. I am wondering where the project information gets stored?
The projects can be found under the .metadata directory of your workspace:
[eclipse-workspace]/.metadata/.plugins/org.eclipse.core.resources/.projects
Each project contains a .location file (in binary format) which presumably tells eclipse where the project is located on the filesystem, if it has been imported.
By default projects in Eclipse are stored under your workspace. You get asked where your workspace is created or which one to open whenever you open Eclipse, but you can configure it to not ask you again.
If you configured Eclipse not to ask again, then you can go to General -> Startup and Shutdown -> Workspaces in your preferences and check "Prompt for workspace on startup".
That page also lists your recently used workspaces (with probably just 1 entry, if you never explicitly specified a different one).
Note that you can also create projects that are located outside of your workspace, by explicitly specifying a separate location per-project.
Browse over to your workspace folder. You will see a folder for each project.
(Don't know where your workspace folder is? Try File -> Switch workspace... and it will give you the path.)
In Windows, usually C:\Users\%USERNAME%\workspace
Where %USERNAME% is the username given to your computer. eg. john
You can paste the above path in Run(Windows + R) window and it will pick the username automatically for you though.
For Eclipse Kepler SR2 on Windows 7
The easiest way to retrieve general info about a project (e.g., its location), see the following:
go to your "Package Explorer" view;
right-click on your project top-hierarchy folder;
choose "Show In" -> "Properties";
and you'll get the list of properties for that project in the "Properties view". Location of project will be in there.
On a Windows PC, you should be able to find your projects under C:\Users\yourname\workspace\. If you're on Linux, it should be under /home/yourname/workspace/.
I used the "Try File -> Switch workspace" suggestion which works but also re-installed Eclipse 0_0