84

I just updated Java to 1.8 u25, and now I get this message every time I try to open Eclipse

enter image description here

I have no clue what I'm doing wrong, when it comes to Eclipse. I have re-downloaded it number of times but still cannot get it to work. How could I fix this?

This is my eclipse.ini file

-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20140603-1326
-product
org.eclipse.epp.package.standard.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vm
C:\Program Files (x86)\Java\jdk1.8.0_25\jre\bin
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.8
-Xms40m
-Xmx512m
8
  • @Harry, it probably is: If it's so, this might need to be closed. Nov 19, 2014 at 15:01
  • Which version Eclipse have you downloaded? Java 8 support is provided by default for Luna and Kepler (need to download support packages)
    – Adheep
    Nov 19, 2014 at 15:13
  • @Adheep I have Luna installed.
    – chif-ii
    Nov 19, 2014 at 15:19
  • 2
    @Harry NOT a duplicate. I have the same issue. Notice the -vm option in the error message does not match the one in eclipse.ini file. In my case there isn't even such an option mentioned in the ini file. The other question is from Feb 2011 whereas this problem started happening after Java 8 Update 25 has been installed. It worked fine with the last release of Java 7.
    – ADTC
    Jan 3, 2015 at 14:25
  • 3
    It is a duplicate. The problem is as @Sergey Morozov described, 64-bit eclipse with 32-bit jre or vice versa. This is described more fully in a sticky in the newcomer eclipse forum, eclipse.org/forums/index.php/t/198527 Sep 9, 2015 at 13:23

7 Answers 7

155

This error occurs because your Eclipse version is 64-bit. You should download and install 64-bit JRE and add the path to it in eclipse.ini. For example:

...
--launcher.appendVmargs
-vm
C:\Program Files\Java\jre1.8.0_45\bin\javaw.exe
-vmargs
...

Note: The -vm parameter should be just before -vmargs and the path should be on a separate line. It should be the full path to the javaw.exe file. Do not enclose the path in double quotes (").

If your Eclipse is 32-bit, install a 32-bit JRE and use the path to its javaw.exe file.

8
  • Good catch! I forgot the x86 vs x64 versions of Java. I made this mistake once.
    – hfontanez
    Nov 19, 2014 at 15:53
  • 6
    I didn't need to add the path to the ini file, because the x64 installer just made new symlinks in C:\ProgramData\Oracle\Java\javapath pointing to the x64 binaries. Of course the next time an x86 update is installed, this is going to point back to x86 binaries until the update for x64 is installed. It's better to add the path, but you will need to update it each time there is an update to Java 8 x64.
    – ADTC
    Jan 3, 2015 at 14:34
  • 4
    Oh BTW, I only installed the x64 version of the JRE to get Eclipse to run. Eclipse only needs the JRE to run. The JDK is only needed when you want to develop Java 8 applications.
    – ADTC
    Jan 3, 2015 at 14:34
  • to the point! had a similar issue, i was running the eclipse on centos box (86_64) and had 32 bit java on my PATH. After changing the PATH to get a correct 86_64 java package, eclipse worked like a charm. Thanks.
    – Rishi
    Apr 12, 2017 at 18:06
  • Updating eclipse.ini to point to appropriate JRE/JDE is better because you have full control to point to appropriate location. Also any java update in future will not affect your eclipse jre/jdk setting Apr 4, 2019 at 2:42
57

Like Vito mentions, this error occurs after Java updates as the path:

C:\ProgramData\Oracle\Java\javapath

is added to the Path environment variable, causing Eclipse to run using the wrong java version.

To fix the problem:

1) Right-click on Computer and choose Properties.

2) Click Advanced system settings

3) Click Environment Variables...

4) Find the Path variable in the System variables section.

5) Choose it and click Edit...

6) Find and delete the above mentioned path.

This fixed it for me. I should mention that I already have the path:

c:\Program Files\Java\jdk1.7.0_21\bin

in the Path variable, but the new path was added to the beginning of the Path variable and therefore resolution would use that path first.

7
  • 2
    This solved it for me. I guess Java 8 made the PATH change and reinstalling Java7 did not update the PATH. Thus my eclipse was trying and failing to run under J8_x86, no matter how many times I reinstalled J7_64. Manually altering the path variable immediately fixed the problem.
    – Karl
    Aug 20, 2015 at 16:42
  • This worked for me. Thanks! Mar 3, 2016 at 15:15
  • Wouldn't deleting this C:\ProgramData\Oracle\Java\javapath path break something else? Or this is just for Eclipse's use?
    – Floella
    Mar 14, 2016 at 13:38
  • 1
    This helped just like that..You saved lot of my time. Thanks a lot :)
    – Motilal
    Apr 17, 2017 at 19:33
  • 1
    Both the accepted answer and this answer solved the problem for me. I still prefer this answer because if other programs use the same path as eclipse, they will also then use the wrong path as well.
    – OuuGiii
    Mar 11, 2020 at 10:50
14

This is caused when java is updated. You have to delete in environement path : C:**ProgramData\Oracle\Java\javapath**

4
  • 1
    Please, show the user the exact command.
    – frb
    Apr 23, 2015 at 9:53
  • for me it works. Start, search sistem environement variables, environement variables again, find "path" and edit it, remove C:**ProgramData\Oracle\Java\javapath** ad Vito said.
    – pagurix
    May 7, 2015 at 14:00
  • @frb running sysdm.cpl, Advanced tab, "Environment Variables" button. Then look for "Path" in the lower box, edit it as needed.
    – Dimas
    Mar 30, 2017 at 13:19
  • c://path-to-java-folder/jdk/bin should be your class path entry ,keep it in user variables ,match 64 bit jdk and sts.done
    – Shaurya
    Dec 13, 2019 at 6:27
6

My solution: Because all others did not work for me. I deleted the symlinks at C:\ProgramData\Oracle\Java\javapath. this makes eclipse to run with the jre declared in the PATH. This is better for me because I want to develop Java with the JRE I chose, not the system JRE. Often you want to develop with older versions and such

0
3

I also faced the error code when i upgraded my java version to 1.8. The problem was with my eclipse.

My jdk which was installed on my system is of 32 - bit and my eclipse was of 64 - bit.

So solve this problem i downloaded the 32 - bit eclipse.

IMO this Architecture miss match problem

Plese match your architecture type of JDK and eclipse.

2

Since you didn't mention the version of Eclipse, I advice you to download the latest version of Eclipse Luna which comes with Java 8 support by default.

1

This is often caused by the (accidental) removal of the JRE folder that is set in the Eclipse configuration. You can try following these instructions from the Eclipse wiki on how to configure the eclipse.ini file to include the the JRE location, or alternatively, launch eclipse from the command prompt using VM arguments. I have tried them both myself and in my opinion, the command prompt option works much better.

Once you are able to launch Eclipse, make sure you verify the installed JRE location under Java --> Installed JREs in the Preferences window.

1
  • 1
    Managed to modify it so the eclipse loading screen starts, but then it immidiately opens an error screen that says "Failed to load the JNI shared library "c:\Program Files (x86)\Java\jdk1.8.0_25\jre\bin\client\jvm.dll"
    – chif-ii
    Nov 19, 2014 at 15:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.