83

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
Bruce_Wayne
  • 1,326
  • 2
  • 17
  • 38
chif-ii
  • 985
  • 1
  • 6
  • 12
  • @Harry, it probably is: If it's so, this might need to be closed. – Buhake Sindi Nov 19 '14 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 Mohamed Abdul Kader Nov 19 '14 at 15:13
  • @Adheep I have Luna installed. – chif-ii Nov 19 '14 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 03 '15 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, https://www.eclipse.org/forums/index.php/t/198527/ – Erick G. Hagstrom Sep 09 '15 at 13:23
  • Unfortunately the other question has the wrong answer selected, making it a bit more difficult to detect the duplicate. – Erick G. Hagstrom Sep 09 '15 at 13:24
  • Here is what worked for me, Check your java version if its 64 bit or 32 bit. Then check what's your eclipse version 64 or 32 and then install accordingly jdk 64 bit or 32 bit – Rishabh Agarwal Aug 21 '17 at 21:17
  • Perhaps it is time for Eclipse to do the same as IntelliJ - bundle a suitable JRE with it. – Thorbjørn Ravn Andersen Jan 04 '19 at 14:58

7 Answers7

153

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.

ADTC
  • 7,367
  • 2
  • 57
  • 82
Sergey Morozov
  • 4,398
  • 3
  • 24
  • 37
  • Good catch! I forgot the x86 vs x64 versions of Java. I made this mistake once. – hfontanez Nov 19 '14 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 03 '15 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 03 '15 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 '17 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 – Rakesh Prajapati Apr 04 '19 at 02:42
  • Nice answer ! In my case, some software pushed by the network admin has changed the default java path to x86 JRE. – Sankar Natarajan Jul 11 '19 at 06:54
  • Hooray! I'm saved! +1 – Cardinal System Sep 08 '19 at 00:05
  • @sergey Morozov , your Note proved helpful in my case. My java version as well as eclipse were 64 bit but -vm parameter, in eclipse.ini file, was added somewhere in between. As soon as I wrote -vm parameter just above the -vmargs parameter, eclipse started ! Thanks – Nilesh Dec 30 '19 at 10:58
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.

Svend Hansen
  • 3,045
  • 3
  • 28
  • 45
  • 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 '15 at 16:42
  • This worked for me. Thanks! – Matt Swezey Mar 03 '16 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 '16 at 13:38
  • If you already have the java `Path` like I mention, it shouldn't break anything. If you don't, you should add a path to the correct java location, similar to the one above (the specific jdk one). – Svend Hansen Mar 14 '16 at 17:35
  • 1
    This helped just like that..You saved lot of my time. Thanks a lot :) – Motilal Apr 17 '17 at 19:33
  • This solved the issue for me as well. Remember, this happens whenver you do click ok for java update from your system tray (in windows) or other place on other *nix environments. – Nirmal Aug 02 '17 at 17:56
  • 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 '20 at 10:50
14

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

Vito Sebastiani
  • 147
  • 1
  • 3
  • 1
    Please, show the user the exact command. – frb Apr 23 '15 at 09: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 07 '15 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 '17 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 '19 at 06: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

alvaro
  • 432
  • 5
  • 13
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.

hfontanez
  • 2,640
  • 2
  • 21
  • 29
  • 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 '14 at 15:12