I was setting up my Eclipse environment with some new plugins today and ran into some trouble, which seems to have bothered many souls as I gather from the posts I found when trying to fix the problem.
Some tools/plugins/features in Eclipse may need to use a JDK rather than a JRE. Sometimes you may even wish to switch between different versions of the JRE or JDK being used since typically 1.4, 1.5/5 and 1.6/6 are all present on a developers’ system at different locations.
I got a mesage from a Maven plugin which said that it needed a JDK to be used to run Eclipse instead of a JRE that it was currently using. Well, this shouldn’t usually present much of a problem. You can choose the virtual machine used to run Eclipse by passing the -vm argument to eclipse.exe. What’s usually needed is something like “eclipse.exe -vm c:\jdk1.6\bin\javaw.exe”. Mind you, javaw.exe is used when you don’t want an associated console window.
I did have JDK 1.6 installed. But it was installed to “C:\Program Files\Java\jdk1.6.0_07″. That, it seems, is the default location. The space in the path caused big problems. I tried quotes\no quotes and other magical incantations to get it to accept the argument with a space but to no avail.
So instead of using the command line switch, I put an entry into eclipse.ini which is in the same directory as eclipse.exe. But this didn’t work either.
Finally, what did work was that I started command.exe (the 16 bit DOS shell) and navigated to the JDK directory using “dir /X” for help which shows names generated in the format “C:\PROGRA~1\JAVA\JDK16~1.0_0\BIN”. Perhaps you remember coming across such filenames.
Anyway, the older 8.3 style directory name worked! My final eclipse.ini is posted below.
-showsplash
org.eclipse.platform
–launcher.XXMaxPermSize
256M
-framework
plugins\org.eclipse.osgi_3.4.0.v20080605-1900.jar
-vm
C:\PROGRA~1\JAVA\JDK16~1.0_0\BIN
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
I was using Windows XP with SP3 and Eclipse 3.4. There is likely to be a better solution that I missed. If you have it or if this post helped you, please leave a coment.


September 27, 2008 at 7:38 pm |
Thanks a lot… It helped me get rid of the Jdk 1.6 it was always picking…
I also tried the quotes and everything… and even tried to put the vm arg using a shortcut and passing the command line arg but it did not work… the old is gold style seems to work very well.
Thanks again mate…
Cheers
December 29, 2008 at 3:49 pm |
Thanks for ur useful post.
goodluck.
February 19, 2009 at 7:41 pm |
For me, it works by setting it with spaces into eclipse.ini
February 19, 2009 at 7:42 pm |
It’s me again. I’m using eclipse 3.4.0 under Windows XP SP3
April 8, 2009 at 7:49 am |
Just 5 seconds before I found your post, I’ve figured it out by replacing ‘\’ with ‘/’:
-vm
C:/Program Files/Java/jdk1.6.0_11/bin
and it worked!
And your method is also great! Thanks man!
April 23, 2009 at 10:34 am |
Ur comment is very useful .Thanks.
May 14, 2009 at 8:20 pm |
Thank you! Thank you! Thank you!
May 29, 2009 at 9:08 pm |
just a quick suggestion
try putting “\ ” instead of ” ” that should help
what i mean is that escape all spaces with a backslash
Hope that helps.
May 29, 2009 at 9:10 pm |
can’t get this bit
if i put my site in website your wordpress says comment discarded.
my website is anantshri [dot] info
May 30, 2009 at 10:31 pm |
Err, odd. Might be due to to some WordPress spam filter.
June 5, 2009 at 1:59 am |
Thank you for your post! It helps me to solve similar issue you were getting..
June 11, 2009 at 1:30 am |
Mine works fine without any error.
-vm
c:\Program Files\Java\jdk1.6.0_13\bin
August 21, 2009 at 12:25 am |
Thank you for this. Very helpful and I no longer get that annoying message.
August 23, 2009 at 2:27 pm |
Many thanks. Yes. MVN plugin was the bitch.
September 20, 2009 at 4:28 am |
Mine works without any errors as well. I had the same problem, and it ended up being because the -vm option was located below the -vmargs option in the ini file. Once I moved it up, everything worked fine, even with spaces.
October 22, 2009 at 11:53 pm |
Thanks everyone. By combining Onkar’s tip with those of several of the commenters I finally fixed the problem!