16

When Eclipse first start, it creates some config files and folders on my hard drive (contains information about work-space ...etc...). I don't like the position it creates config files because config files are all put in my C:\Users\Long folder and that's ugly. I want to put all those config files somewhere else (C:\Eclipse\ for example). This happens in Linux too.

Do you know how to put those files in somewhere else?

5 Answers5

21

Just add the following to your eclipse.ini file (found at the root eclipse installation folder):

-Dosgi.configuration.area=file:/C:/Workspace/.eclipse 
Lucky
  • 16,787
  • 19
  • 117
  • 151
Damior
  • 211
  • 2
  • 3
  • 4
    This will not solve the problem, C:/Workspace/.eclipse will be created, but also there will be .eclipse and .p2 folders created in user.home directory... at least in windows platform (and eclipse neon). – MrSimpleMind Sep 05 '16 at 12:51
  • 1
    @MrSimpleMind You can add 'eclipse.p2.data.area=@config.dir/../p2' and the .eclipse issue seems to be solved with Oxygen (4.7). – usr1234567 May 08 '17 at 16:50
  • @usr1234567 I will try oxygen and check this, I really hope it is fixed! I have a thread, and forum discussion here for more info http://stackoverflow.com/questions/39168906/ – MrSimpleMind May 08 '17 at 20:52
  • @usr1234567 Not working for me... any idea? The folders are still created under c:\users\{USER} – jlanza Aug 11 '17 at 15:47
  • I have found https://stackoverflow.com/questions/10017395/change-secure-storage-directory-in-eclipse-user-home-path-issue-on-windows which seems to work by changing the user home to the location you like. Don't know if it is safe to do that – jlanza Aug 11 '17 at 16:14
2

To change the default .eclipse folder location, go to ${eclipse.home}, open your eclipse.ini with a text editor and insert there one line more:

-Dosgi.configuration.area=/path_to_new_folder_location/.eclipse/

  • why the downvote? That's valid answer. Downvote for unreasonable downvotes and upvotes for answer. Be nice and precise to newcomers, plz. – WesternGun Jul 25 '17 at 07:35
  • 2
    @FaithReaper: I'm not the downvoter, but this answer is exactly the same as the most upvoted one. It adds nothing. – zb226 Aug 02 '17 at 09:10
  • @zb226 Now I see this. It is different in wording, but is not copying anyway.. I think it neither deserves upvotes nor downvotes.. – WesternGun Aug 02 '17 at 11:26
2

As someone already said, adding the property -Dosgi.configuration.area in the eclipse.ini file does the trick.

But in my opinion it would be better to rely on the user.home variable and set the destination like for the other variables.

Example with -Dosgi.instance.area.default:

-Dosgi.instance.area.default=@user.home/eclipse-workspace

In my case I just wanted another destination than the default @user.home/.eclipse which was still used by the Eclipse Mars that I keep for old projects and I just defined:

-Dosgi.configuration.area=@user.home/.eclipse-oygen-3

to have a specific destination for the Eclipse Oxygen 3 installation.

Note that syntax works for both Windows and Linux (I did not tested on OSX, but I guess it should).

рüффп
  • 5,172
  • 34
  • 67
  • 113
1

Eclipse has some command line arguments you can use. One of those arguments is the flag -data which tells Eclipse where the workspace of Eclipse should be located.

So when I create a new workspace, I normally create a shortcut under Windows (or script file under Linux) with the following contents:

eclipse.exe -vm <JDK>\bin\javaw.exe" -data ws -nl en

This defines which JDK should be used, that the workspace is located under ws and that the english locale should be used.

mliebelt
  • 15,345
  • 7
  • 55
  • 92
  • Sorry! That's not what I asked for. This is what I asked for: http://www.eclipse.org/forums/index.php/m/671060/ I hate the .eclipse folder and I want it to go somewhere else, wherever, just stay out of my home folder! –  Nov 27 '11 at 16:59
  • I have read what you pointed at, and I don't think you are right. I never ever has an additional folder created for me, I only have the eclipse installation directory, and the workspace directory. So skip my answer, but enhance your question if you want a proper answer ... – mliebelt Nov 27 '11 at 17:16
  • I have rechecked at home and started eclipse just by doubleclick on `eclipse.exe` under Windows 7. I get asked which workspace to use, and when I ask the open eclipse its configuration (`Help > About Eclipse Platform > Configuration Details`) I find the following line `osgi.configuration.area=file:/D:/programme/java/eclipse/eclipse-europa-fall/configuration/` which is exactly the installation directory of my eclipse. – mliebelt Nov 27 '11 at 17:25
  • In the link I provided above, there is a post at the end. It said: "No luck here, I fear. To be clear, what I mean by 'no luck' is that when I make my config changes and restart Eclipse, it just recreates a .eclipse directory in $HOME and asks me where to put my workspace, rather than just finding it. Any more ideas?" It said about the .eclipse folder. I forgot to mention that I was using Spring System Tool Suite. But Spring STS is Eclipse-based so I think Eclipse is the same. –  Nov 27 '11 at 18:51
0

IMHO parameter -configuration does the trick. It must point to a subdirectory named "config". Eclipse will fill this and the upper directory itself with files, e.g. for a JBoss server installation.

If you have more than one eclipse installation, then you should use a different directory for each eclipse installation.

Example how to keep everything in defined places:

"C:\Program Files (x86)\eclipse\eclipse48jee\eclipse.exe" -nl en_US -vm "C:\Program Files (x86)\Java\jdk1.8.0_212\bin" -configuration C:\EclipseData\eclipse48jee\config -data C:\Workspaces\SomeProject

GigaGo
  • 1