14

I have tried all different settings, and yes, I m aware of eclipse.ini and config.ini and also tried different command line arguments! Nothing solved my problem!

All attempts and still each time I run eclipse.exe it wants write to my userhome i.e. the .eclipse and .p2 folders.

I have tried with all settings bellow among others, in different combinations too:

-Dosgi.user.area=file:/c:/eclipse-conf/e46
-Dosgi.configuration.area=file:/c:/eclipse-conf/e46
-Dosgi.instance.area=file:/c:/eclipse-conf/e46
-Declipse.p2.data.area=file:/c:/eclipse-conf/e46/p2
-Dorg.eclipse.equinox.p2.configurationFolder=file:/c:/eclipse-conf/e46/p2
-Dorg.eclipse.equinox.p2.installFolder=file:/c:/eclipse-conf/e46/p2
-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=file:/c:/eclipse-conf/e46/p2
-Dorg.eclipse.equinox.p2.cache=file:/c:/eclipse-conf/e46/p2
-Dorg.eclipse.equinox.p2.roaming=file:/c:/eclipse-conf/e46/p2
-Dorg.eclipse.equinox.p2.cache.shared=file:/c:/eclipse-conf/e46/p2

This did not help! Well it writes to /e46 and /e46/p2 folder but it also creates/writes to c:\users\mrsimplemind\.eclipse & .eclipseextension & .p2 Even if I manually create the folders before it will not help.

Now please anyone here had success to fully isolate eclipse configuration output?

The only way I achieved this was by changing the user.home but I don't like this workaround as there are stuff in the original "user.home" that will be needed in eclipse, e.g. .ssh , .git , .m2 maven etc. I don't want to keep duplicates of profile settings for each eclipse user.home

I just want to isolate eclipse, this should be configurable! I don't like the outputs to user.home .. It is not an option! I want to have control of what eclipse creates in what folders, for each eclipse installation.

(I can only tell from windows os, I don't know how if Eclipse on Mac works better with the settings above)


I dont use OOMPH installer, some comments below are misleading

MrSimpleMind
  • 7,890
  • 3
  • 40
  • 45
  • I do not get a .p2 directory (but I am using a Mac). The standard Eclipse downloads do use the Oomph installer which I think uses that directory. You have to search out the non-oomph install these days which is just a zip file. – greg-449 Aug 26 '16 at 20:43
  • @greg-449 I use e.g. eclipse-jee-neon-R-win32.zip, I unzip it and there is no installation. If I dont modify eclipse.ini it will write all configurations to user.home/.eclipse and user.home/.p2 ... but I dont want it like this. – MrSimpleMind Aug 26 '16 at 21:08
  • Have you tried recording a trace of the system calls as you start Eclipse? Just before it makes the system calls to open or create the folders you want to avoid, it will make system calls to read the environment variables or retrieve the arguments it uses to determine where to create or open these folders. Also there are links to chase here: http://stackoverflow.com/questions/8223489/move-default-config-folder-of-eclipse – Daniel Wisehart Sep 03 '16 at 12:49
  • Possible dupe of this: http://stackoverflow.com/questions/8288452/how-to-move-eclipse-folder which the user says solved his problem. – Daniel Wisehart Sep 03 '16 at 12:51
  • @DanielWisehart I have not recorded any trace before, can you give me how-to guide? I have seen both url you sended. First is about the config (Im happy with the default config path eclipse uses, under the installation folder. And the data area have I tried. As you can see I already mention the settings in my question. I have tried it. I want to avoid the .eclipse and .p2 folder in my user.home. I don't want to set the global java user.home to something else.. as already mentioned above. – MrSimpleMind Sep 03 '16 at 20:55
  • 1
    @DanielWisehart as you can see, no one has given any answer. This is not a duplicate. Eclipse writes .eclipse and .p2 folder in user.home folder. I don't want those folders there. The normal configuration (plugins etc) they are okey as the gets into the configuration folder under the eclipse installation folder itself. – MrSimpleMind Sep 03 '16 at 20:57
  • You say it is not a pos dupe, but @user477768 says he successfully moved his .eclipse directory. Did you try his method? – Daniel Wisehart Sep 04 '16 at 12:59
  • It seems you are running on Windows. You need the Process Monitor tool, which is part of the SysInternals package. Use it to start, monitor and record the stack of your eclipse instance: https://technet.microsoft.com/en-us/sysinternals/bb896645.aspx On Linux you use strace or its variants. On Mac you use dtruss. – Daniel Wisehart Sep 04 '16 at 13:05
  • @DanielWisehart I tried all combinations, as you can see in my question. user477768 tried the osgi.configuration.area and eclipse.p2.data.area. The folders I se here does contain data when eclipse run. So they work. BUT Eclipse still writes .eclipse and .p2 folders in my user.home. I did run process monitor, but I really cant understand what to read in the 200+ mb big file. I see that it creates the folders. etc. – MrSimpleMind Sep 05 '16 at 13:29
  • The only way I managed to avoid anything in my user.home folder is to pass a new user.home property to eclipse. BUT I dont want that, I still want eclipse to read my user.home git, mave, security passport etc. – MrSimpleMind Sep 05 '16 at 13:30
  • OK, having the Process Monitor output is a good start. Search through the document looking for the first time ".eclipse" was accessed. What are the couple hundred lines before this? Anything looking at "user.home" or environment variables or configuration files? You will probably get better info if you delete .eclipse and then run Eclipse and Process Monitor again. – Daniel Wisehart Sep 05 '16 at 16:56
  • 1
    @DanielWisehart I think one must live with this, it is not possible to prevent write to user.home, the aeri and oomph (even if I dont use oomph installation) they do write to user.home ! I saw a thread (just few months old)... https://www.eclipse.org/forums/index.php/t/1077328/ – MrSimpleMind Sep 06 '16 at 07:16
  • For what it is worth I did pull in some of the Eclipse source and I started looking though, but Eclipse is enormous. It is a huge undertaking. I would probably put a hard link to where ever I wanted .eclipse to actually live. – Daniel Wisehart Sep 06 '16 at 14:49
  • "The only way I achieved this was by changing the user.home but I don't like this workaround as there are stuff in the original "user.home" that will be needed in eclipse, e.g. .ssh , .git , .m2 maven etc. I don't want to keep duplicates of profile settings for each eclipse user.home" Why don't you just do that and create shortcuts to .ssh, .git, etc.? – m4110c Sep 22 '20 at 19:45

4 Answers4

2

The method I have tried to solve this problem has been nearly successful. Whether this is an answer for you will depend on your minimum acceptable level of quality.

  • If you are trying to prevent your Eclipse IDE from filling up your home drive, this technique will work (it has worked for me). It should not matter if Eclipse was installed by Oomph or from a plain zip, as nothing Oomph-related is modified in this solution.
  • If the requirement is that the user home p2 folder can be completely deleted and yet Eclipse still works without recreating that directory, no I have not been able to achieve that yet.

I am posting this as a partial solution, perhaps in the hope someone else can build upon it to figure out a better workaround. Obviously the perfect solution would be if eclipse had a configurable download location and the installer actually installed all software to only the location selected, but that requires the Eclipse developers to fix the "P2" component of the product. What follows is only a workaround.

Strategy

The premise is that the download pool folder always seems to be hardcoded into the config files to be under the home folder of the user that ran the eclipse installer. The essence of this workaround is to create a fake user home folder in the location of your choice, do a massive find-and-replace in the config files, and then force the Java system property to use that new folder as "user.home" which fools Eclipse into using it for its downloads.

Method

This was tested on Eclipse 4.7 Oxygen.3A on Mint Linux.
Extensive brain surgery of the Eclipse installation folder is needed.

  1. Install Eclipse somewhere other than your user's home drive.
    In this example the Oomph installer was given /media/LINAPPS/ubuntu-apps/eclipse-oxy as the install target, which then creates /media/LINAPPS/ubuntu-apps/eclipse-oxy/eclipse during the installation.
  2. Start Eclipse at least once, then close it and make sure Eclipse is not running.
  3. Create a new fake user home drive folder underneath the Eclipse folder.
    In this example I created eclipse-oxy/eclipse/fakeHome
  4. Copy the entire (hidden) p2 directory from your user home directory into the new fakeHome.
    eg cp -R /home/$USER/.p2 /media/LINAPPS/ubuntu-apps/eclipse-oxy/eclipse/fakeHome/.p2
  5. Go to the eclipse folder and edit the eclipse.ini in a text editor. Make these 2 changes:
    • set the line after --launcher.library to be the copy of the pool in the new location relative to the eclipse folder, eg : fakeHome/.p2/pool/...etc...
    • append a new system property setting to end of the file after all the other vm arguments, and set user.home to the new fake user home directory.
      eg: -Duser.home=/media/LINAPPS/ubuntu-apps/eclipse-oxy/eclipse/fakeHome
  6. Edit the file eclipse/configuration/org.eclipse.update/platform.xml. Find the first <site> entry and change the url attribute to be the new pool folder relative to the eclipse folder. eg: url="file:fakeHome/.p2/pool/"
  7. Edit the file /media/LINAPPS/ubuntu-apps/eclipse-oxy/eclipse/configuration/org.eclipse.equinox.simpleconfigurator/bundles.info and again find and replace all references to you user home's p2 folder with the new p2 folder under the fakeUser. You could find over 1000 matches to replace here. It again seems to be possible to make these relative to the eclipse folder, so a path of "fakeHome/.p2/pool/....." will work.
  8. Go to the new /eclipse/fakeHome/.p2 folder and edit both of the files there "pools.info" and "profiles.info". Again find any reference to your real user home and replace it with the path to the fakeUser folder. Use the full pathname (from root) for the pool location in both of these files.
  9. Unpack, edit, and repack the latest profileRegistry. Find the folder
    eclipse/fakeHome/.p2/org.eclipse.equinox.p2.engine/profileRegistry/_media_LINAPPS_ubuntu-apps_eclipse-oxy_eclipse.profile/. Now find the latest timestamped gz file in that folder. For example it might be called "1529736854441.profile.gz".
    gunzip that .gz file. Edit the .profile file and again replace any mention of your real user home with the new fakeUser folder. For example in my installation one of the first property settings had to be changed to
    <property name='org.eclipse.equinox.p2.cache' value='/media/LINAPPS/ubuntu-apps/eclipse-oxy/eclipse/fakeHome/.p2/pool'/>
    Delete the old gz file, then gzip the profile into a gz, so it has replaced the old one.
  10. I also edited the file /eclipse/fakeHome/.p2/org.eclipse.equinox.p2.core/cache/artifacts.xml and replaced the repository name with a reference to the new location inside fakeHome, but I am not sure this was necessary to get eclipse working.
  11. Start eclipse.

Results

After doing the above, I tried to add Install New Software from the Help menu. After downloading lots of new plugins from Redhat and Spring, the new fakeHome pool occupies 900MB, but the original user home pool is still less than 400MB which is what it was as soon as eclipse had been installed. So it has been successful at moving the download cache of the updater and no files get updated in the old location, but two directories under .p2 still seem to have their timestamps touched.

If anyone finds this useful, or figures out how to improve it, please let me know.

andrew8088
  • 41
  • 7
2

This works on Windows 7, Eclipse Oxygen:

  • Install Eclipse, but DON'T launch it yet
  • Edit eclipse.ini and, underneath -vmargs, add an entry to change user home to be a shared folder:

e.g.

-vmargs
-Duser.home=C:\Development
  • Launch Eclipse. Should see ".eclipse", ".tooling", etc folders created in shared folder, and nothing created under your user folder.
David Lavender
  • 8,021
  • 3
  • 35
  • 55
  • This is not a solution. As I wrote: The only way I achieved this was by changing the user.home but I don't like this workaround as there are stuff in the original "user.home" that will be needed in eclipse, e.g. .ssh , .git , .m2 maven etc. I don't want to keep duplicates of profile settings for each eclipse user.home ( more info see https://www.eclipse.org/forums/index.php/t/1077328/ ) – MrSimpleMind Jul 11 '18 at 16:35
  • I just tried that for eclipse201906 and am not seeing any directories created in the directory I specified in -Duser.home – JohnC Aug 06 '19 at 21:58
1

As of Eclipse Java 2019-06 for Windows 10 64-bit

I added my eclipse.ini below:

-vmargs

-D"user.home=C:\your_path_here"

The 3 folders of .eclipse, .p2, & .tooling appeared after I started and then closed eclipse.

I am not sure when these are written into the new path, but it worked in my Windows 10.

Community
  • 1
  • 1
  • "The only way I achieved this was by changing the user.home but I don't like this workaround as there are stuff in the original "user.home" that will be needed in eclipse, e.g. .ssh , .git , .m2 maven etc. I don't want to keep duplicates of profile settings for each eclipse user.home" (see my question.) – MrSimpleMind Sep 11 '19 at 06:01
0

Did you try adding the following line to eclipse.ini below -vmargs:

-Dosgi.configuration.area=@user.home/.someFolder

which will use .someFolder instead of .eclipse or

-Dosgi.configuration.area=C:\path_to_desired_location\.eclipseJAVA
sim
  • 9
  • 1