Where are projects stored in Eclipse? - 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

Related

Eclipse projects are not visible in workspace folder

The weird part is I can see my projects through package explorer.
I can also export them.
But when I want to access them elsewhere e.g windows explorer, they are not there.
All I see is .metadata folder.
An unexpected shutdown of the system occurred not too long ago.
Edit: When I switched the workspace, created and opened a project, they're still not visible/accessible outside of the eclipse project explorer.
Any ideas?
You most likely haven't ticked "Copy projects into workspace" checkbox option.
File -> Import -> Existing projects into workspace:
It is possible that the projects were not put into the default, workspace folder.
To check this, right click on such a project, select Properties (it is usually available at the bottom of the list), go to the Resources tab, where you have the location of the project files displayed.
Obviously, there is a problem with Windows explorer and OneDrive in particular.
When I navigate to C:/Users/username/OneDrive/Documents/workspace or through command line I do see my eclipse projects.
But when I try to use 'Open file..' option from any application or navigate through Windows explorer, projects are not recognized nor displayed.

Eclipse is creating an old folder instead of using the new one

I used to have Eclipse in a folder but then I decided to move the folder for Eclipse into a different folder. I deleted the old folder because I no longer needed it. Now Eclipse creates the old folder it used to be located in every time I start Eclipse.
Just to be clear: Eclipse is in folder "eclipse stuff" which got moved from folder A to folder B (both are on the Desktop) and folder A got deleted and now when Eclipse is opened it creates "Desktop\A\eclipse stuff\" with a sequence of folders within it.
My best guess is it is storing default settings in there (based on the names of the things in the folders) and that the directory it stores these "default settings" in is somewhere in Eclipse's settings. I don't know what settings it would be in. How can I change this setting?
You need to switch the workspace. File -> Switch Workspace -> other and choose the new folder. Restarting should preserve the new default workspace. If not, you can also delete old workspace locations in Eclipse setting: Window -> Preferences => General -> Startup and Shutdown -> Workspaces contains a list of all known workspaces. You can delete it there.

common workspace setup in eclipse

I want to create several workspaces which point to different branches of a codebase.
The problem I am facing is every time I need to create a new workspace I have to do the same configuration for each workspace.
Example:
Setting up tomcat configuration and it's related java options such as library and java agent settings.
A system variable that points to specific folder containg my jar files.
Another system variable
Questions:
is it possible to have these setups done once so that all subsequent workspaces do not need to be configured?
is it possible to export these preferences and import later into any workspace either on my machine or other machine?
System information:
Windows 7, Eclipse 3.5, Sysdeo tomcat plugin, Tomcat 6
While eclipse does have an Export preferences option, it does not export everything and specifically it is not comprehensive enough for workspace duplication.
In the past I have had a lot of success just cloning the physical workspace folder itself.
For example, let's say you have setup the workspace with everything that you want in it. To duplicate it, find out the path of the current workspace folder by going to File -> Switch workspace -> Other. The path shown here in the dialogue that pops up is the current workspace path ( don't press ok yet)
Create a copy of this folder. Now to use this copy, just use it in the above dialogue, i.e., go to File -> Switch workspace -> Other and put in the path of the copy. Press OK and Eclipse shall restart with the new workspace. Now the only thing you will have to do is point the code to a different branch. Rest all the settings should be present already.
This works specially well on the same machine. If you copy this workspace folder it should still work but your mileage may vary.

How to move NetBeans Workspace?

I have installed NetBeans in C drive and now I want to move it to another drive.
Is there any option available in NetBeans?
There is the option of project group.
File > Project group.
Here you can create a project group based on a folder location.
Then you can switch between projects within selected group.
Switching between project groups doesn't require closing the IDE.
It look like Workspace for Eclipse.
Hope it will help!
Right click on your project
In the context menu, select "Move..." option
Choose the location you want to move your project to
You want to copy the so called "userdir".
For details, please refer to the FAQ:
http://wiki.netbeans.org/FaqWhatIsUserdir
http://wiki.netbeans.org/NetBeansUserFAQ#Configuration
I am using NetBeans 8.0.2 on Windows 7.
The projects in my workspace are also in a "Project Group" by root directory for a suite of projects. (What Eclipse would call a "workspace" for all projects, or a "Working Set" for a subset of projects.)
In C:\Users\<myname>\AppData\Roaming\NetBeans\8.0.2\config\Preferences\org\netbeans\modules\projectui\groups\<mygroup>.properties is listed the path to the group of projects.
In Explorer, move (: or copy if you are paranoid enough :) your workspace directories to the new drive.
Edit this file and change the drive location for the group.
NetBeans will now see the new location when it opens and loads the workspace and groups.
Use File / Project Groups ... to ensure you are looking at the group you think you are looking at.

How to change the Eclipse default workspace?

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