41

I have a problem with m2eclipse (0.10.0) together with eclipse galileo (Build id: 20090920-1017).

I always get the error message:"Eclipse is running in a JRE, but a JDK is required". I have tried several things, but nothing works. The error message is still there. Here are the things I have tried:

  • In Window>Preferences>Java>Installed JREs I checked JDK1.6.0_20. DOES NOT WORK

  • In Window>Preferences>Java>Installed JREs I removed all JREs. Only the checked JDK1.6.0_20 is still there. DOES NOT WORK

  • In Window>Preferences>Java>Installed JREs>Execution Environments I choosed JavaSE-1.6 and checked JDK1.6.0_20[perfect match]. DOES NOT WORK.

  • In Preferences of the eclipse desktop start icon I added the -vm parameter (C:\Programme\eclipse_galileo\eclipse\eclipse.exe -vm C:\Programme\Java\jdk1.6.0_20\bin). DOES NOT WORK.

  • I added the clean parameter (C:\Programme\eclipse_galileo\eclipse\eclipse.exe -vm C:\Programme\Java\jdk1.6.0_20\bin -clean). DOES NOT WORK.

  • I added the -vm parameter to the eclipse.ini file with a carriage return after -vm and C:/Programme/Java/jdk1.6.0_20/bin/javaw.exe in a new line. DOES NOT WORK.

  • After doing all these things I removed the m2eclipse plugin and installed it once again. DOES NOT WORK.

New ideas I have tried:

  • In Preferences of the eclipse desktop start icon I put the executable at the end (C:\Programme\eclipse_galileo\eclipse\eclipse.exe -vm C:\Programme\Java\jdk1.6.0_20\bin\javaw.exe). DOES NOT WORK.

  • I changed in eclipse.ini the slashes to backslashes. DOES NOT WORK.

Here is my eclipse.ini file:

-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.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:\Programme\Java\jdk1.6.0_20\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m

Is anyone out there who have other ideas? Any help is appreciated.

Thank You very much. GernoK

Sean Patrick Floyd
  • 292,901
  • 67
  • 465
  • 588
GernoK
  • 411
  • 1
  • 4
  • 4
  • 1
    See http://stackoverflow.com/questions/142357/what-are-the-best-jvm-settings-for-eclipse/1409590#1409590 for a concrete example of `eclipse.ini` format. – VonC May 27 '10 at 13:45
  • Please edit your question if you want to provide more detail or clarification. – Tim Post Feb 04 '11 at 10:50
  • To whom it may concern: I used to have the exact same problem, until I've updated to Indigo. Works a spell! – s.d Sep 02 '11 at 15:16

15 Answers15

26

Unbelievable, the solution to this problem has nothing to do with slashes, backslashes, quotes, spaces, jre, jdk, jvm, javaw, ....

The answer is that you have to have a line break between

-vm

and the path.

So in the eclipse.ini file:

THIS WILL NOT WORK:

-vm C:\java\jdk\bin\javaw.exe

BUT THIS WILL:

-vm
C:\java\jdk\bin\javaw.exe
Jeremy Goodell
  • 18,225
  • 5
  • 35
  • 52
  • Yes, but you also need to take care of the position of the -vm, must be after -vmargs. Look at my answer above for full explanation. – Daniel Baktiar Sep 07 '12 at 02:40
13

MARIO-ORTEGON answered is the right answer to this problem. The only thing you need to do is to move this line "-vm C:\java\jdk\bin\javaw.exe" under the section -product org.eclipse.epp.package.jee.product in eclipse.ini. like this: -product org.eclipse.epp.package.jee.product -vm C:\java\jdk\bin\javaw.exe save and restart the eclipse. Error will be gone.

Ran Azad
  • 131
  • 1
  • 3
11

I think these are answers needed when editing the eclipse.ini or STS.ini files:

A lot of people make these mistakes because they make certain assumptions (which is not correct):

  1. Mistake #1: Writing the parameters in the same line. Unlike JVM command line, Eclipse expects every parameters to be placed in different line in its eclipse.ini file. One of the most common mistake is (which should be written in 2 separated lines):

    -vm c:/Java/jdk1.6.0_31/bin/javaw.exe

  2. Mistake #2: Writing the -vm and -vmargs in the wrong order. Sequence does matter. The -vmargs has to be put before the -vm. Why? Because once the -vm has been specified, the VM will be fully specified and the rest of the -vmargs will be ignored.

  3. Mistake #3: Assuming the eclipse.ini will stay the same if you don't change it. Some plugins installation may have auto configuration (which after restarting automagically change the eclipse.ini file, or other .ini config file, e.g. STS.ini if you are using SpringSource Tool Suite for example), they will append indiscriminately the -vm before the -vmargs. Check for double occurrence of -vm or -vmargs.

  4. Mistake #4: Pointing to the path of JVM, instead of the binary when specifying -vm. Eclipse expects the Java JVM binary, not just the JAVA_HOME path e.g. -vm c:/Java/jdk1.6.0_31/bin/javaw.exe not just -vm c:/Java/jdk1.6.0_31

For the original question, it seems the Mistake #2 is the cause. Instead of the one, you should move the -vm to the end, after -vmargs:

-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.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:\Programme\Java\jdk1.6.0_20\bin\javaw.exe
Daniel Baktiar
  • 1,692
  • 11
  • 22
  • 3
    actually.. if I have -vm after -vmargs, it is superseded by -vmargs, which can be seen if you look at the runtime configuration. It only works if I have -vm before -vmargs, after -product. Using eclipse helios. – eis Sep 26 '12 at 14:11
  • 2
    Kepler, vm cannot be initialized if -vm option is after -vmargs – Gab Dec 19 '13 at 13:46
4

I had the same problem with Eclipse reporting that it was running in the JRE (Win7 x64, 32 Bit JDK 1.6 update 21), even though I was specifying that it should use the JDK.

I finally deleted JRE6 which is optionally installable with the JDK and the message disappeared.

Someone with a deeper understanding of Windows will have to explain why it does this, but it is apparently ignoring the eclipse.ini setting, as well as JAVA_HOME and starting eclipse in the JRE anyway.

My eclipse.ini:

-vm
C:/Java/jdk1.6.0_21/bin/javaw.exe
-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-product
org.eclipse.epp.package.jee.product
-nosplash
org.eclipse.platform
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms32m
-Xmx1024m
-Xss6m
-XX:PermSize=32m
-XX:MaxPermSize=256m
-XX:CompileThreshold=5
-XX:MaxGCPauseMillis=10
-XX:MaxHeapFreeRatio=70
-XX:+UseParallelGC
-XX:+AggressiveOpts
-Dcom.sun.management.jmxremote

JAVA_HOME

C:\Windows\system32>echo %JAVA_HOME%
C:\Java\jdk1.6.0_21
Crutis
  • 49
  • 7
2

I think you have to explicity add the executable to the -vm argument:

C:\Programme\eclipse_galileo\eclipse\eclipse.exe -vm C:\Programme\Java\jdk1.6.0_20\bin\javaw

Regarding the ini file, it depends on the full contents. What does your ini file contains?

sth
  • 222,467
  • 53
  • 283
  • 367
Mario Ortegón
  • 18,670
  • 17
  • 71
  • 81
2

Put these lines at the beginning of the eclipse.ini file:

-vm
G:/dev/jdk1.6.0_19/bin/javaw.exe
John Conde
  • 217,595
  • 99
  • 455
  • 496
Eduardo
  • 21
  • 1
1

I'm getting the same error message as soon as I remove these two lines

-vm
C:\Programme\Java\jdk1.6.0_10\bin\javaw.exe

from my eclipse.ini file. Maybe you should use backslashes in that eclipse.ini.

xor_eq
  • 3,933
  • 1
  • 29
  • 33
  • 1
    That should have worked. Have you checked if Eclipse is running on the JDK? You can do this at Help->About Eclipse->Installation Details->Configuration there are several entries that hint at what java version is used (e.g. *eclipse.vm* or *sun.boot.class.path*). If Eclipse really uses the JDK your problem is probably a bug in the m2eclipse plugin. – Turismo May 28 '10 at 09:49
  • I don't think that this is an issue anymore, but I was working on something and remembered this. Just a tip: Use a tool like System Explorer to find out about the javaw.exe that is used by eclipse. – xor_eq Jun 10 '10 at 08:49
0

I too had this issue. This problem disappeared when I upgrade to Eclipse Indigo. So try with Higher version.

Prathap
  • 717
  • 2
  • 8
  • 25
0

Check your Installed JRE setting of Eclipse. It should point to JDK rather than JRE. Though it is a JRE setup. Remember JDK contains JRE and when Maven runs it tries to find out JDK mostly tools.jar.

Bipul Sinha
  • 266
  • 2
  • 9
0

There are two JVMs involved here; the one that Eclipse is running in and the one (or more) that the different projects in your workspace run in. I think this message refers to the JVM that Eclipse is running in. So, the solution is not contained in the "Installed JREs" section within Eclipse. It's the JVM that's in your path within Windows.

Rob Heiser
  • 2,792
  • 1
  • 21
  • 28
  • I have edited both enviroment variables (Path and JAVA_HOME) - but no changes. The errormessage is still there. –  Feb 04 '11 at 10:51
0

Java may be finding its files using the JAVA_HOME environment variable. Try changing it to C:\Programme\Java\jdk1.6.0_20

In Windows XP, this is under Control Panel, System, Advanced tab, Environment Variables button.

Powerlord
  • 87,612
  • 17
  • 125
  • 175
0

Try adding this:

-vm E:\java\jdk1.6\jre\bin\client\jvm.dll
sth
  • 222,467
  • 53
  • 283
  • 367
0

Uninstall the JRE leaving ONLY the JDK and private JRE behind. Run Eclipse, and it will immediately complain that it can't find a JRE or JDK (assuming the -vm option is missing or wrong in your ini).

Now put the -vm path to javaw in your ini file, save and Eclipse will now load the JDK.

I actually went ahead and uninstalled everything Java and then reinstalled JDK 6 leaving out the public JRE and the database portion of the install.

Barry
  • 1
0

The uninstall method is the only thing that worked for me. No amount of -vm magic made it happen until I only had the JDK installed.

Batman0730
  • 487
  • 2
  • 5
  • 21
0

I had the same problem but solved it. Add the -vm option as the first line in your eclipse.ini file and it will work.

Ajay
  • 9
  • 1
  • 1
    By using this, you are actually ignoring all the -vmargs which in the end makes the whole Eclipse wouldn't start at all, e.g. some needs -Xmx768m for large projects. – Daniel Baktiar Sep 06 '12 at 17:10