views:

2819

answers:

2

Hi,

Background: I've got a new eclipse installation and have installed the m2eclipse plugin. After startup m2eclipse generates the message:

Eclipse is running in a JRE, but a JDK is required

Following the instructions from here I've changed the eclipse.ini file to use the JDK JVM:

-startup
plugins/org.eclipse.equinox.launcher_1.0.200.v20090520.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-product
org.eclipse.epp.package.jee.product
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
-vm
"C:\Program Files\Java\jdk1.6.0_16\bin\javaw.exe"

After restarting eclipse however, I still get the message saying its running under the JRE and not the JDK.

Looking at the eclipse configuration via Help -> About Eclipse -> Installation Details -> Configuration it seems like eclipse is picking up the JVM configuration details from somewhere else:

...
-vm
C:\Program Files (x86)\Java\jre6\bin\client\jvm.dll
eclipse.home.location=file:/C:/Program Files (x86)/eclipse/
eclipse.launcher=C:\Program Files (x86)\eclipse\eclipse.exe
[email protected]/../p2/
eclipse.p2.profile=epp.package.jee
eclipse.product=org.eclipse.epp.package.jee.product
eclipse.startTime=1252669330296
eclipse.vm=C:\Program Files (x86)\Java\jre6\bin\client\jvm.dll
eclipse.vmargs=-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
-vm
"C:\Program Files\Java\jdk1.6.0_16\bin\javaw.exe"
-XX:MaxPermSize=256m
...

My question is where is the first -vm argument coming from and how can I remove or change it?

Thanks

Update: I have updated the eclipse.ini file as per VonC's answer. I'm now getting an error when launching eclipse saying:

A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse. No Java virtual machine was found after searching the following locations: "C:\Program Files\Java\jdk1.6.0_16\bin\javaw.exe"

I've confirmed that the path is correct and can be executed via the command line.

Complete eclipse.ini below:

-startup
plugins/org.eclipse.equinox.launcher_1.0.200.v20090520.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-product
org.eclipse.epp.package.jee.product
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vm
"C:\Program Files\Java\jdk1.6.0_16\bin\javaw.exe"
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m

Solution: it seems like there was still something wrong with the eclipse.ini file. I replaced it completely with the settings given by VonC in the post he linked and eclipse is now starting properly and using the correct JVM. Full eclipse.ini below for anyone else with the same problem:

-showlocation
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
384m
-startup
plugins/org.eclipse.equinox.launcher_1.0.200.v20090520.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-vm
C:\Program Files (x86)\Java\jdk1.6.0_16\jre\bin\client\jvm.dll
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms128m
-Xmx384m
-Xss4m
-XX:PermSize=128m
-XX:MaxPermSize=128m
-XX:CompileThreshold=5
-XX:MaxGCPauseMillis=10
-XX:MaxHeapFreeRatio=70
-XX:+UseConcMarkSweepGC
-XX:+CMSIncrementalMode
-XX:+CMSIncrementalPacing
-Dcom.sun.management.jmxremote
-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=C:/jv/eclipse/mydropins
+5  A: 

See:

for an example of parameters order.

-vm should be before -vmargs

VonC
Yes, -vm must before -vmargs. See the end of http://help.eclipse.org/galileo/topic/org.eclipse.platform.doc.user/tasks/running_eclipse.htm
Csaba_H
I've tried this and am now getting an error saying that no JVM could be found at the specified location. The path is correct so this must be something to do with eclipse. Any ideas?
Jared Russell
I had the same problem , the solution written here solved the error when eclipse loaded, but when i try to build using maven plugin. it is showing me [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project trojantime: Compilation failureUnable to locate the Javac Compiler in: C:\Program Files\Java\jre6\..\lib\tools.jar
org.life.java
@org: that shouldn't be related to the `eclipse.ini` settings, but to the JRA installed. See http://stackoverflow.com/questions/1431531/how-is-the-eclipse-jdk-setting-affecting-the-systems-jdk-setting/1431554#1431554 (and just in case http://stackoverflow.com/questions/1773060/programmatically-configure-eclipse-installed-jres/1773827#1773827)
VonC
+2  A: 

I think your machine is 64bit windows?

I cannot see a 64bit windows version of eclipse in the site. So only 32 bit might be available. Are you sure you have a 32bit JDK installed in your machine? Just a thought...

Aviator
You're correct, I've got the 64-bit version of the JDK installed and thats what I've got eclipse pointing to. I'll try downloading the 32-bit version and see if I have any better luck.
Jared Russell
Wow! Great. I hope it will work definitely! Gud Luck!
Aviator
No luck I'm afraid, pointing to the 32-bit JDK gives the same error.
Jared Russell
Did you try putting -vm to point 32bit jvm.dll instead of javaw.exe?(use jre inside the JDK for searching jvm.dll)
Aviator
64-bit Eclipse is well hidden on the website as it's not an official platform (god knows why, we've had 64-bit for a while). Here it is: http://download.eclipse.org/eclipse/downloads/drops/R-3.5-200906111540/index.php
hbunny
Yeah have tried that as well. It gives exactly the same error about not finding a JVM.I've also found that there is a 64-bit windows version of eclipse here: http://download.eclipse.org/eclipse/downloads/drops/R-3.5-200906111540/index.phpThis version also generates the same error about not finding a JVM when pointed to the 64- bit JVM.
Jared Russell
looks like steven beat me to the link :)
Jared Russell
@stevendick:@jared:Wow! I could have never found it. THanks guyz!@jared:Oh! :(. I thought it might solve the problem. my bad!
Aviator
Hi jared.. sorry about so many options; :)Did you try the bin path of JDK? like this; -vm <path to JDK home>\bin
Aviator
Fixed my problem by pointing the eclipse.ini to a 32 bit java jdk.
Taylor Leese
Great! Good to hear that
Aviator