Thursday, April 28, 2011

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

Eclipse by default runs on a JRE. But, there may be times you want a full JDK to run it. One example is using Maven Plug-in.

Change the eclipse.ini (Located in the same folder as in your eclipse.exe file) file with a vm argument pointing to your jdk.

The important things are :
1. Enter a new argument "vm" pointing to the java jdk's javaw.exe file
-vm
C:/Program Files/Java/jdk1.6.0_20/bin/javaw.exe
2. vm and the path should be in a separate line. So if you have
-vm C:/Program Files/Java/jdk1.6.0_20/bin/javaw.exe
in a single line, Eclipse can not identify it.
3. "vm" argument should be before "-vmargs" and after" --launcher.XXMaxPermSize"
-vm
C:/Program Files/Java/jdk1.6.0_20/bin/javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx768m
-XX:MaxPermSize=256m


You can point to the java/bin folder also, for the vm argument. Some people got an exception because of a space in the file path location of java, so you might try installing Java into a non-space file path like C:/Java/jdk1.6.0_20.


This also works the same way for the Spring Source Tool Suite and you can see this concerned thread, http://forum.springsource.org/showthread.php?t=86906.