Fixing Eclipse’s Java Dependancy Errors

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!


Tags: , , ,

  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

23 Responses to “Fixing Eclipse’s Java Dependancy Errors”

  1. freakqnc says:

    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. FettesPS says:

    @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. andrea says:

    thanx for the post, it helped fixing my problem!

    cheers from Venice

  4. Khurram says:

    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
    —————————

  5. Mark says:

    Thanks guys

  6. vikrant says:

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

  7. Hannes says:

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

  8. vita says:

    Thanks !!! 🙂

  9. Nick says:

    Khurram!!! I’m getting the same error! Did you fix it!?

  10. Waleed says:

    I tried the root post it prompts another Error stating

    Failed to Load JNI Shared Libaray

  11. yous says:

    freakqnc thanks for your 2 cents

  12. hg3 says:

    Gracias me resulto aplicandondolo con el javaw.exe que se encuenta en el sistem 32.

  13. Alam says:

    Hi
    thanks alot man…
    its very useful. i can run eclipse just whit this way…
    thank again

  14. agateknik says:

    very helpful…i love this
    thanks ,,

  15. Joachim says:

    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\

  16. Allan Alves says:

    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.

  17. Travis Ross says:

    Thanks this was quite helpful.

  18. Nico says:

    Thanks a lot!!!

  19. Kimberly says:

    My Shortcut to eclipse will not open

  20. MANU shanu says:

    thanx buddy works fine

  21. shree says:

    Thanks alot.. It is really works..

  22. AB says:

    Didn’t work. This worked for my win7 64 bit:
    Manually download java for your operating system:
    https://www.java.com/en/download/manual.jsp
    Change the install folder to the eclipse folder. Done.

  23. […] Fixing Eclipse’s Java Dependancy Errors | FettesPS – While setting up Eclipse on my development station in order to compare it to NetBeans I encountered the following error: I have Java installed, and it is. FettesPS Fettes … A Java Runtime Environment (JRE) or Java Development … Program Fileseclipseeclipse.exe” -vm “C:Javajdk1.6.0_13 … […]

Leave a Reply