Java

Fixing Eclipse’s Java Dependancy Errors

October 7, 2009

While setting up Eclipse on my development station in order to compare it to NetBeans I encountered the following error:

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\Eclipse\jre\bin\javaw.exe 'javaw.exe' in your current path

I have Java installed, and it is working properly. It was a big pain to get working properly the first time with NetBeans so I was worried that if I tweaked it to work with Eclipse I may end up with it not working in either. I took a peek into many of the config files for Eclipse and didn’t see an option to set the path for javaw.exe, so I made use of my Google-Fu skills and found the following solution:

  • Right Click Eclipse.exe and select Create Shortcut
  • Right Click the new shortcut and select Properties
  • At the end of the target path, add the parameter -vm and then the path to your javaw.exe
    ie: “C:\Program Files\eclipse\eclipse.exe” -vm C:\Java\jdk1.6.0_13\bin
  • Hit Ok, then run Eclipse from your new shortcut

Problem solved!

Only registered users can comment.

  1. Thanks for the post (dated but still very useful :P)

    I will add my 2 cents which may help others looking for a solution to this problem…

    For me it only worked if I specified the text as:
    “C:\Program Files\eclipse\eclipse.exe” -vm “C:\Java\jdk1.6.0_13\bin”

    At first I though it may have been the smart quotes (curly quotes copied from this page) that cam in the way, but even after re-typing them myself it did not work, so I surrounded both paths in double quotes and Eclipse launched just fine 🙂

    I hope it helps anyone having the same problem I encountered.

  2. @freakqnc – Thanks for the heads up, my server is Linux based so I’m assuming that’s why the quotes are “curly.” I wouldn’t have noticed that if you didn’t mention it though.

  3. Hi, I did the above mentioned -vm “c:\java\jdkx.x.x\bin” step. but after that my eclips run and at once show the following error box, please advise. —————————
    Eclipse
    —————————
    JVM terminated. Exit code=-1
    -Dosgi.requiredJavaVersion=1.5
    -Xms40m
    -Xmx512m
    -XX:MaxPermSize=256M
    -Djava.class.path=E:\Eclipse 3.4.2\plugins\org.eclipse.equinox.launcher_1.0.101.R34x_v20081125.jar
    -os win32
    -ws win32
    -arch x86
    -showsplash E:\Eclipse 3.4.2\\plugins\org.eclipse.platform_3.3.101.v200902111700\splash.bmp
    -launcher E:\Eclipse 3.4.2\eclipse.exe
    -name Eclipse
    –launcher.library E:\Eclipse 3.4.2\plugins\org.eclipse.equinox.launcher.win32.win32.x86_1.0.101.R34x_v20080731\eclipse_1115.dll
    -startup E:\Eclipse 3.4.2\plugins\org.eclipse.equinox.launcher_1.0.101.R34x_v20081125.jar
    -framework plugins\org.eclipse.osgi_3.4.3.R34x_v20081215-1030.jar
    -vm C:\Program Files\Java\jdk1.6.0_18\bin\..\jre\bin\server\jvm.dll
    -vmargs
    -Dosgi.requiredJavaVersion=1.5
    -Xms40m
    -Xmx512m
    -XX:MaxPermSize=256M
    -Djava.class.path=E:\Eclipse 3.4.2\plugins\org.eclipse.equinox.launcher_1.0.101.R34x_v20081125.jar
    —————————
    OK
    —————————

  4. Thanks man,
    i was struggling with this from a long time. But why this error comes at the first time? Can you please explain?

  5. Thanks! Never thought this would work but it does, after placing the “”-symbols correctly like ‘freakqnc’ explained in his post.

  6. As alternative to -vm on Windows 7 a junction worked fine for me (easy to switch jre via a script):

    c:\eclipse>mklink /J jre c:\glassfish3\jdk7\
    Verbindung erstellt für jre c:\glassfish3\jdk7\

  7. If you are using Linux. You should check in “/etc/alternatives” the link “java”, it should be broken.
    In this case, you have to type ” sudo ln -s /usr/lib/jvm/$YOUR_JAVA_HOME/bin/java “.
    Brienfing, you should find a file with the name “java” in “/usr/lib/jvm/$YOUR_JAVA” and make the link inside of the folder “/etc/alternatives”.
    I hope to help linux users.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.