I want to configure my Eclipse environment to use the JDK instead of the standard JRE. I'm doing this because I use m2eclipse, which requires tools.jar from the JDK to run.
I'm running Eclipse 3.5.1 on Windows 7 32-bit with JDK 1.6.0_16.
On my system, I have the JDK installed to "C:\Program Files\Java\jdk" (symlink to the latest install).
I add the -vm option to eclipse.ini to point to the JDK
-vm
C:/Program Files/Java/jdk/bin
I've confirmed that eclipse is in fact starting with the desired JVM. In the configuration details
eclipse.vm=c:/Program Files/Java/jdk/bin\..\jre\bin\client\jvm.dll
Additionally, in my environment,
JAVA_HOME=c:\Program Files\Java\jdk
However, in Window | Preferences | Java | Installed JREs, the only JRE listed is the one in "C:\Program Files\Java\jre6". This JRE ends up being the one under which Maven is run, and so my maven builds fail.
I know I can manually change the Installed JRE to point to the JDK, and this is what I've done in the past. However, I'd like to find a way to script this change so that I can automate the installation of a dev environment.
Where is this setting stored? What is the best way to automatically configure Eclipse to use the JDK as the only Installed JRE?
Eclipse is an IDE that runs on a java VM. It only requires a jre. However, if you plan on developing Java applications, you probably want a JDK (Oracle supplies both. The licensing is different and they have different tool sets) A JRE just runs java applications.
Eclipse is a Java-based application and, as such, requires a Java Runtime Environment or Java Development Kit (JRE or JDK) in order to run.
The setting is stored in
<workspace>\.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.jdt.launching.prefs
I would recommend setting your JDK manually in Preferences / Java / Installed JRE, as well as Preferences / Java / Installed JRE / Execution Environment.
Then, whenever you need an eclipse with that exact configuration, just copy over this file with your preset config file, and launch that eclipse.
Extract from that config file:
org.eclipse.jdt.launching.PREF_DEFAULT_ENVIRONMENTS_XML=
<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>
<defaultEnvironments>
<defaultEnvironment environmentId\="JavaSE-1.6"
vmId\="57,org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType13,1255369536255"/>
</defaultEnvironments>
eclipse.preferences.version=1
org.eclipse.jdt.launching.PREF_VM_XML=
<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>
<vmSettings defaultVM\="57,org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType13,1255369536255">
<vmType id\="org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType">
<vm id\="1255369536255"
javadocURL\="http\://java.sun.com/javase/6/docs/api/"
name\="jdk1.6.0_16" path\="C\:\\Prog\\Java\\jdk1.6.0_16">
<libraryLocations>
<libraryLocation jreJar\="C\:/Prog/Java/jdk1.6.0_16/jre/lib/resources.jar"
jreJavadoc\="http\://java.sun.com/javase/6/docs/api/"
jreSrc\="C\:/Prog/Java/jdk1.6.0_16/src.zip"
pkgRoot\=""/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With