Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change .eclipse folder in Linux

Tags:

linux

eclipse

ide

How can I change the .eclipse folder in Linux? I tried adding this line:

-Dosgi.configuration.area=/directory/directory1/eclipse/.eclipse

at the top of eclipse.ini but it doesn't work. I've also tried adding it to various other places in the eclipse.ini but still no luck.

Edit

I have added this line:

-Dosgi.configuration.area=file:/directory/directory1/eclipse/.eclipse

immediately below -vmargs. When Eclipse starts, it now reads from the correct .eclipse location and if .eclipse does not exist there, it creates it. Unfortunately, after Eclipse has loaded, another .eclipse folder is created in my home folder and Eclipse then continues to read from that folder. I suspect that my eclipse.ini file is now correct but there is another file I need to change.

like image 479
Dan Bray Avatar asked Feb 14 '16 00:02

Dan Bray


2 Answers

The simplest thing to do is probably pass java a different user.home so that all the other myriad of places that derive a location base it off of user.home. So instead of what you have, use this in .ini file:

-Duser.home=/directory/other/here

In addition to .eclipse, you will probably find other directories created in your overridden user.home, such as .p2, .oracle_jre_usage, etc.

Other notes:

-Dosgi.configuration.area is the changes the configuration area for Eclipse, it does not effect user area. You also probably don't want to change that setting away from the default unless you really want multiple configurations (read more below).

Additionally, the normal thing to do would be to use -configuration as an argument to eclipse{.exe} and let eclipse convert it to the appropriate VM argument.

You probably want -user though to override the user area. Have a look at locations in the Eclipse help for more info (quoted below).

However, there are still things that have individual control over their location, such as secure storage, which is controlled by the -eclipse.keyring command line argument.

Locations

The Eclipse runtime defines a number of locations which give plug-in developers context for reading/storing data and Eclipse users a control over the scope of data sharing and visibility. Eclipse defines the following notions of location:

User (-user) {osgi.user.area} [@none, @noDefault, @user.home, @user.dir, filepath, url] User locations are specific to, go figure, users. Typically the user location is based on the value of the Java user.home system property but this can be overridden. Information such as user scoped preferences and login information may be found in the user location.

Install (-install) {osgi.install.area} [@user.home, @user.dir, filepath, url] An install location is where Eclipse itself is installed. In practice this location is the directory (typically "eclipse") which is the parent of the eclipse.exe being run or the plugins directory containing the org.eclipse.equinox.launcher bundle. This location should be considered read-only to normal users as an install may be shared by many users. It is possible to set the install location and decouple eclipse.exe from the rest of Eclipse.

Configuration (-configuration) {osgi.configuration.area} [@none, @noDefault, @user.home, @user.dir, filepath, url] Configuration locations contain files which identify and manage the (sub)set of an install to run. As such, there may be many configurations per install. Installs may come with a default configuration area but typical startup scenarios involve the runtime attempting to find a more writable configuration location.

Instance (-data) {osgi.instance.area} [@none, @noDefault, @user.home, @user.dir, filepath, url] Instance locations contain user-defined data artifacts. For example, the Resources plug-in uses the instance area as the workspace location and thus the default home for projects. Other plugins are free to write whatever files they like in this location.

While users can set any of these locations, Eclipse will compute reasonable defaults if values are not given. The most common usecase for setting location is the instance area or, in the IDE context, the workspace. To run the default Eclipse configuration on a specific data set you can specify:

eclipse -data c:\mydata
like image 99
Jonah Graham Avatar answered Sep 30 '22 12:09

Jonah Graham


You must put property definitions like this at the end of the eclipse.ini after the -vmargs line. If there is no -vmargs line you must add one.

So:

.... other lines ....
-vmargs
... other arguments
-Dosgi.configuration.area=/directory/directory1/eclipse.eclipse
like image 23
greg-449 Avatar answered Sep 30 '22 13:09

greg-449