Move default config folder of eclipse - eclipse

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?

Just add the following to your eclipse.ini file (found at the root eclipse installation folder):
-Dosgi.configuration.area=file:/C:/Workspace/.eclipse

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/

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).

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.

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

Related

Installing Eclipse without changing the PATH env variable

Is it possible to specify the jvm that the eclipse installer will use? I'm getting the error "Version 1.7.0_67 of the JVM is not suitable for this product. Version: 1.8 or greater is required".
I want to install eclipse oxygen and I have jdk 8, but I don't want to mess with the PATH environment variable that is currently pointing to jre 7, because I fear it may confuse other programs. Is there any way to do this?
Update:
I tried creating an eclipse-inst.ini file as suggested and placed it in the same directory as the installer (note, I didn't edit anything, since there was no existing file).
Tried a number of options for the second line (of course not all at the same time like below):
-vm
C:/zIMC/imc-dev-1.8/jdk8/jre/bin/javaw.exe
C:/zIMC/imc-dev-1.8/jdk8/bin/javaw.exe
C:/zIMC/imc-dev-1.8/jdk8/bin/java.exe
C:/zIMC/imc-dev-1.8/jdk8/bin/
C:/zIMC/imc-dev-1.8/jdk8/jre/bin/server/jvm.dll
Also tried most of them with backslash instead. The last one is from the eclipse.ini of my old installation, which is using jdk7. None of them works, all still give exactly the same message then the installer is run.
I faced the same issue
Download zip version of eclipse,
Once deployed open text file at root folder eclipse.ini
Add the following lines:
-vm
C:/java/jdk1.8.0_144/jre/bin (put correct path for your jvm here)
I added the lines after --launcher.appendVmargs , but i am not sure if that makes any difference.

data switch has no effect when given in eclipse.ini

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.

How to specify Eclipse "plugins" directory

I have several Eclipse RCP applications in the same suite, whose executables are in the same directory. I'd like to have a different "plugins" directory for each.
Can I do this, and if so, how?
[I know that I could also put all the plugins into the same directory and specify version-specific dependencies, but this is a special case.]
I was able to get this to work after a few hours of reading, experimentation and head-banging. I couldn't find the answer in Stackoverflow; hopefully this will help the next person to look.
First, I restructured the directory containing my executables. A shared "plugins" directory had been alongside the executables. I made copies of it in application-specific subdirectories, and removed the original.
parent
foo.exe
foo.ini
foo
configuration
config.ini
plugins
bar.exe
bar.ini
bar
configuration
config.ini
plugins
Next, I added settings similar to the following, to the top of each *.ini file, above -vmargs. [Your version numbers may vary.] An option and its argument are separated by line breaks.
-startup
foo/plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
-install
foo
--launcher.library
foo/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20120522-1813/eclipse_1503.dll
And this existing setting was already underneath -vmargs.
-Dosgi.sharedConfiguration.area=file:configuration
Note: although this works, the "configuration" directory and the -Dosgi.sharedConfiguration.area setting are anachronisms from a single -install directory. It would be more elegant to have config.ini alongside the plug-ins directory, and omit the setting. However, I didn't get that part to work, and can live with it.

Unable to start Eclipse -- can't open \Java\jre6\lib\i386\jvm.cfg

could not open C:\Program Files\Java\jre6\lib\i386\jvm.cfg
is the error coming when i am trying to start eclipse ide.
my C:\Program Files has
jdk1.6.0_14
jdk1.6.0_17
jre6
folders.
path is set to
PATH: C:\Program Files\Java\jdk1.6.0_17\bin
what is the problem
i have seen this link but it is not solving my problem
can't find JRE in the JDK
I had similar problem on a Windows machine. I had moved my Java directory from inside "Program Files" (the space in the directory name was giving me trouble) over to c:\
I set all my PATH variables to the new location, restarted the machine and thought that would be enough. Nope
java -- version
Error: could not open `C:\Program Files\Java\jre1.8.0_66\lib\i386\jvm.cfg
This solution came from the good folks over at coderanch
Start regedit (just type "regedit" into the Run program) and work your way down to HKEY_LOCAL_MACHINE > SOFTWARE > JavaSoft
There you will find several different java directories
Java Development Kit
Java Plug-in
Java Runtime Environment
Java Update
Java Web Start
In each directory you'll find different directories for the different version of java (esp. Java Web Start). Open each and every one and you'll see that your old path is still listed. Double click the Name (left column) of the listing and manually type in the new path.
Open a new terminal and type in Java - version and you should be fine.
This problem can show up if you initially install Java in the default location (C:\Program Files) and then later re-install into another location.
The default installation copies java.exe, javaw.exe and javaws.exe to C:\Windows\System32. If you are in this situation and delete these files it will likely solve your issue.
(Thanks to Jay: http://jaykhimani.blogspot.com/2012/09/error-could-not-open-cprogram.html)
Problem: Eclipse Neon error: "C:\Program Files\Java\jre1.8.0xx.xx\jvm.cfg"
Solution Win7 Pro: System Properties > Enviorment Variables > System Variables > Path > Edit > #make sure the current JAVA directory appears first in the path if more than 1 JAVA directory exist.
In the path that follows, I moved "C:\ProgramData\Oracle\Java\javapath" behind the current directory "C:\Program Files\Java\jdk\bin;C:\Program Files\Java\jre\bin" > save
Path
C:\Program Files\Java\jdk\bin;C:\Program Files\Java\jre\bin;C:\apache-maven-3.5.0\bin;C:\ProgramData\Oracle\Java\javapath
I also had this problem and was having trouble finding a solution, but now I did!
If you uninstall your current running jre version and then install higher one you are good to go.
I was using jre1.6 when I had this problem but after installing 1.7 it was solved!
I recently got the same problem on my Windows 7. The issue was that two different paths were specified for Java in the path environment variable. This can be checked as follows.
On the command prompt, run the following command:
> where java
C:\Program Files (x86)\Common Files\Oracle\Java\javapath\java.exe <br/>
C:\Program Files\Java\jdk1.8.0_192\bin\java.exe
The first one was the cause of the issue and removed it from the path.
Eclipse is working now without re-installation.
Note: The environment vars have been as follows always:
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_192
JRE_HOME=C:\ProgramFiles\Java\jdk1.8.0_192\jre
The problem is that your eclipse cant find jre.Just copy and paste your jre folder into eclipse folder and then start eclipse.Delete environment variable.
What worked for me was to go back to the Java webpage and download the Java jre instead of the jdk, since that is what the stupid computer is now looking for. Then open the C: Program Files>Java and make sure you see jre7 instead of jdk.
RS
Have a simpler solution:
Check your PATH. Most likely it is referring to incorrect java.exe. This started happening to me when I installed OS patch. In process of checkpoint etc, PATH got modified. Once I corrected it (using Environment Variables...), it worked immediately.
Try putting below line in your eclipse/STS -STS.ini file
-vm
C:\Program Files\Java\jdk1.8.0_121(your JDK version)\bin\javaw.exe
Put it at the top of the file.
Most probably it will work.
Sometimes putting javaw.exe in eclipse folder also work (where eclipse.exe is there)
This is an old post, but what solved my solution was editing the `eclispe.ini' file to include the correct path to the JDK.
Building off of what Lars answered, I did reinstall Java, so that may have been the source of the issue. Reglardless, this is the solution that worked for me. I did not have to delete any files from C:\windows\system32, however. I merely told eclipse to look in the new Java installation directory.
These docs indicated I needed to specify the path to the VM:
-vm
C:\Java\jdk1.7.0_25\bin\javaw.exe
This problem mainly occurs when we install new jre or jre gets updated automatically since jdk version and jre version are different and path variable i.e. JAVA_HOME contains jdk path with version included in it . Eclipse might be using that to generate the jre path name for the said file.
I did workaround i.e. changed name of jre folder to the older version e.g.
jre1.8.0_191 is after installing update and
jre1.8.0_60 was before update.
I renamed jre1.8.0_191 with jre1.8.0_60 to solve the issue
I had faced similar problem. Environment variable path problem
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_192
Set the Environment variable after going
Control Panel\All Control Panel Items\System and select Advanced System Settings then set Environment Variables
In System Variables add a new variable JAVA_HOME and variable value = C:\Program Files\Java\jdk1.8.0_192, the path of the jdk file in your system.
and %JAVA_HOME%\bin in the path of the system variables.
Hopefully the problem will solve.
After doing this It works fine for me.

Using various Eclipse ini files

I am using a software client based on Eclipse (Ganymede) and its all working fine.
However, one small thing would make my world perfect...
In the Eclipse home folder, there is an ini-file. Is there a way to have various ini-files and choose (for example by arguments or environment variables) a specific ini file and create a shortcut for it?
Many thanks,
You can make as many shortcut you want with the:
the eclipse.exe executable
the option --launcher.ini /your/eclipse.ini
See Eclipse Help page on Runtime Options:
--launcher.ini <location> (Executable)
The location of the product .ini file to use.
If not specified the executable will look for a file beside the launcher with the same name and the extension .ini.
(ie eclipse.exe looks for eclipse.ini, product.exe looks for product.ini)
So you can have more than one "eclipse.ini" file: each one will be referenced as an argument within the --launcher.ini option.
The easy way would be to have a shell script (for *nix) or batch file for windows that would simulate the behaviour you want
#!/bin/ksh
echo "first arg is the name of the ini file to use otherwise using default one"
ln -s $1 eclipse.ini
#launch eclipse