I'm trying to speed up Eclipse by having my projects on a RAM disk (stuck with a slow laptop and a heavy kind of eclipse project at the moment). Worked great for loading the project and such, but when I'm building it seems to read and write a lot to a directory in %APPDATA% (seems to have a generated name from the name of the project). This makes it actually go slower than usual...
So... is there a way I can move the tmp directory of eclipse? Preferably without moving the tmp directory of other applications in the process.
May have found a way by setting a property called java.io.tmpdir in eclipse.ini. Seems to have changed where most of the read/write activity happens during build at least. For example:
-vmargs
-Xms128m
-Xmx1024m
-XX:MaxPermSize=256M
-Djava.io.tmpdir=E:\tmp
Not sure if it have to be after the -vmargs thing or not, but this seems to work anyways.
It can be done by Djava.io.tmpdir property
->On root directory of your project right click as select run or debug as then in:
In Run/Debug Configuration of your project
->Run configuration
->Arguments-->
In VM Arguments
write the complete path of your temp directory
example: if you want to select a folder JAVAtmp in F drive then pass the VM arguments as :
-Djava.io.tmpdir=F:\JAVATmp
Related
I believe this is normal user's behavior:
After downloading the eclipse IDE distribution, such as eclipse-jee-mars-2-win32-x86_64.zip file, you unzip it to a folder, e.g. C:. The eclipse executable is at C:\eclipse\eclipse.exe. (Here I'll refer C:\eclipse directory as eclipse home directory.)
When running, eclipse will write some temp or customization file under eclipse home directory, so the eclipse home directory became dirty. I wonder if there is any parameter or configuration file setting so eclipse will write those cache/temp/customized data to somewhere else.
I'm not talking about '-clean' parameter. From the help file, I think I should try -configuration configURL. However I don't know the format of the configuration file.
Here is the best I've got so far after some trial and errors:
Take C:\eclipse as my eclipse home directory, which is extracted from eclipse distribution zip file. My goal is to keep this home directory clean.
I created the following directories:
C:\eclipse-work.ws
C:\eclipse-work.home\user
C:\eclipse-work.home\configuration
Here is the command line I used to start eclipse, of course it's part of a script:
C:\eclipse\eclipse.exe -data C:\eclipse-work.ws -user C:\eclipse-work.home\user -configuration C:\eclipse-work.home\configuration
The trick is I need to make configuration directory to be a two level directory as eclipse will generate other cache or data under C:\eclipse-work.home dir.
This is the best I can get so far. All cache data, as well as plug-ins I installed, will be in the C:\eclipse-work.home directory. There is only one file generated under original eclipse home directory, that is a profile gz file under
p2\org.eclipse.equinox.p2.engine\profileRegistry\epp.package.jee.profile
directory. And this file won't be changed once it's created.
I'm using a ram disk. Using above approach I can setup the eclipse IDE in the ram disk image file. Now eclipse starts much faster.
For that -user directory, so far I didn't observe any file generated under it. Not sure if it can be omitted.
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
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.
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.
Start Eclipse at least once, then close it and make sure Eclipse is not running.
Create a new fake user home drive folder underneath the Eclipse folder.
In this example I created eclipse-oxy/eclipse/fakeHome
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
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
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/"
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.
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.
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.
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.
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.
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.
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.
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
I want to set up workspace location for an Eclipse instance in order to distribute it to some of my friend. I must use relative path to workspace for this. So far I decided to use data switch to point particular workspace located inside the Eclipse directory. The problem is when I use command-line switch like this:
./eclipse -data workspace
it works fine, but when I try to add this at the end of eclipse.ini like this
-data
workspace
it does not seem to have any effect. Note that I've tried to restart Eclipse with clean switch after editing eclipse.ini.
I noticed that setting osgi.instance.area in eclipse/configuration/config.ini let me point to workspace but I couldn't get relative (to elcipse directory) path working. I tried a number of solutions (#user.dir/workspace, platform\:/base/workspace and just workspace), all they actually compute relative path from user home directory (and platform solution creates directory named platform in user's home).
The desired behaviour is implemented in Scala IDE, but I can't figure out how they get this.
When add to the eclipse.ini file check if there is a -vmargs entry in the file. Everything in the file after any -vmargs is treated as a VM argument not an Eclipse argument.
So add the -data at the start of the file.
I am getting the following error, while launching Eclipse:
The eclipse executable launcher was unable to locate its companion shared library.
Previously Eclipse was working fine when I had jre6 installed on my pc. After installing jre7 update 25, I am no longer able to launch Eclipse.
My Eclipse ini-file has these lines:
-startup
plugins\org.eclipse.equinox.launcher_1.0.100.v20080509-1800.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.1.R36x_v20100810
How do I fix this error? Any help would be great.
Had similar issue, which was a result of update. Please make sure that names of libraries mentioned in eclipse.ini and the actual names of these files on your disk match exactly.
-startup
plugins\org.eclipse.equinox.launcher_1.0.100.v20080509-1800.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.1.R36x_v20100810
Here is the post that I used to fix this issue on my system http://codewithgeeks.blogspot.in/2013/11/fixing-eclipse-executable-launcher-was.html
It worked only after removing the eclipse folder and all related folders like .p2, .eclipse (in my case they are at different location where I have saved eclipse installer) etc. and after re-downloading the eclipse, it worked.
In my case, this error occurred because of windows 7 shortcuts. In windows we create shortcuts on desktop by using right click > send to > desktop. In my pc, there is no option for desktop, but there is one for "documents". I created the shortcuts there and then moved them to the desktop. Executing these shortcuts causes the error. Eclipse works fine when I run it directly from the folder where it is installed. I fixed it by using right click > create shortcut and then moving this shortcut to the desktop.
This is an issue with the 64 bit version of Kepler and windows7 in my case.
I downloaded the 32 bit and it worked immediately.
In my case I have moved plugins folder mistakenly to another folder while taking backup of my unnecessary projects.
Then while I was trying to run the eclipse.exe I was getting the error-
The Eclipse executable launcher was unable to locate its companion
shared library.
I have simply copied the plugins folder to eclipse root directory, and it was working fine for me.
If you have the folders backup in your computer then just copy and paste the folders on eclipse directory, you don't need to reinstall or change the ini file so far I realized.
This happened to me when deleting some Equinox package from my plugins directory, make sure this is not the case.
The reason to that might be the 2 lines in eclipse.ini
--launcher.library
C:\Users\UserName\.p2\pool\plugins\org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.400.v20160518-1444
for my case the reason was admin privilages so I had to move the folder from the path specified in ini to my eclipse plugins and change path in ini to :
plugins\org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.400.v20160518-1444
This worked for me
On the Zipped folder of the ADT you initially downloaded unzip and navigate to:
adt-bundle-windows-x86_64-20140702\eclipse\plugins
Copy all the executable jar files and paste them on the
C:\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\eclipse\plugins
directory (or wherever your adt is located).
Any executable jar files missing in the plugin folder will be added. You should be able to launch eclipse
I encountered the similar problem after installing new software. In my case, the problem was solved by: (1) restoring .p2 subdirectory under my home directory; and (2) editing eclipse.init file to have the updated java directory.
In my case, i had copied a plugins folder into workspace from a collegue. Becaouse it was an unzipped folder, the structure was like 'pluginsfolder inside a plugins folder2 . so make sure that all the plugins are directly located under the toppest plugins folder at the workspace.
In my case eclipse.ini entry for --launcher.library was :
--launcher.library
C:\Users\UserName\.p2\pool\plugins\org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.551.v20171108-1834
and on my machine 'C:\Users\UserName\.p2\' folder was missing hence installed the eclipse again which created the .p2 folder structure at required location and now I am able to login successfully.
I followed the below steps and it worked for me.
Step1:
Edit eclipse.ini by adding javaw.exe path and remove --launcher.appendVmargs line.
Below shows the original and edited file
Orginal eclipse.ini
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.8
After editing eclipse.ini:
openFile
-vm
C:/ProgramFiles/Java/javapath/javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.8
Step2:
Copied the org.eclipse.equinox.launcher_1.5.700.v20200207-2156.jar to eclipse installation folder .
You can find the .jar location in eclipse.ini
eg : C:\Users\Username.p2\pool\plugins
In my current project settings, I have configured Eclipse to place the compiled .class files in the /bin directory.
My puzzle is that, when I run the application via the IDE and get it to print the current working directory (System.out.println(System.getProperty("user.dir")) I expect the console output to be /bin - instead the value printed is the projectRoot folder (without the /bin suffix).
If I were to navigate to the /bin folder directly, and execute my java class, the current working directory is printed as I expect it to be. What I would like is the Eclipse IDE to behave similarly.
Any ideas as to why I am observing this disparity? I have gone through many project build settings, but cannot seem to find anything that would cause this anomaly.
Kind regards,
Dinuk
In Eclipse, the working directory defaults to the project directory.
You can change this in the run properties
(Project->Properties->Run/DebugSettings->Edit->Arguments tab, at the bottom of the page).
Edit: Actually, the easiest way to get to it is Run->Open Run Dialog->Arguments tab.
It's been a while since I used Eclipse.
From an example of Eclipse Setup New Project
alt text http://apps.sourceforge.net/mediawiki/sprite2d/nfs/project/s/sp/sprite2d/a/ae/EclipseNewProjectDebugArguments.jpg