151

I just downloaded Eclipse as an archive and installed newest 64 bit Java and 64 bit Java Development Kit 15. And I get this error. I installed JDK 11 after and got the same error.

How can I make this work?

8
  • 9
  • 7
    @howlger Praise thee. It works. But i'm still waiting for a day when Java and Eclipse works out of the box similar to C# and Visual Studio. Sep 21, 2020 at 16:46
  • 2
    @CommanderCat That doesn't work "out-of-the-box" either when you have multiple versions of C# like you had with Java. It's an apples-to-oranges comparison anyway. Sep 21, 2020 at 17:17
  • 2
    Both downloaded from official oracle website. Even with one JDK and JRE it also didn't work. Java is just hot mess, you have to do everything manually, which is awful for beginners. Sep 21, 2020 at 18:18
  • 1
    Oracle provides JDKs, not JREs anymore. Do you get the same issue when downloading Java from adoptopenjdk.net? 3 of the 13 Eclipse IDE packages are allready shipped with Java: Eclipse for C/C++, for Web/JavaScript and for Rust developers (Oracle has prevented this from happening earlier). In the future, probably also the Java IDE will be shipped with Java. The question is not how long you have to wait for others to make something freely available to you, but how long we have to wait for you to contribute something to the open source tools and frameworks you use.
    – howlger
    Sep 22, 2020 at 7:38

21 Answers 21

210

The Java to run Eclipse can be specified in the eclipse.ini file (see Eclipse wiki: eclipse.ini - Specifying the JVM). Add the following two lines directly before the line -vmargs and adapt the path to your Java 11 or higher 64-bit Java VM installation directory:

-vm
C:\Program Files\AdoptOpenJDK\jdk-14.0.2.12-openj9\bin\javaw.exe

Alternatively, you can put the Java VM into the jre subdirectory of the Eclipse installation or, if you do not install Eclipse but upgrade it, install Java 11 or better Java 14 as plugin before the upgrade from Eclipse JustJ (use JustJ OpenJDK Hotspot JRE Complete, not Base or Minimal).

Please note, that even if you run Eclipse with Java 11 or higher, Eclipse 2020-09 (4.17) still supports to code in Java 14, 13, 12, 11, 10, 9, 8 and even much older versions (down to Java 1.1). Java 15 can be installed via Marketplace.

14
  • 13
    This solution help me to fix the issue. I removed the -vmargs and replaced with -vm only
    – dipakbari4
    Oct 9, 2020 at 19:59
  • 1
    @DipakBari All lines after -vmargs are used as arguments for the Java VM. Removing the -vmargs line might cause issues.
    – howlger
    Oct 10, 2020 at 14:39
  • 1
    @hram908 Better edit the eclipse.ini file than changing JAVA_HOME since JAVA_HOME is also used by other applications which might not yet work with Java 11.
    – howlger
    Oct 23, 2020 at 9:25
  • 7
    Make sure to put "-vm" and the path "C:/...." on separate lines (exactly as it is shown above). I thought it wasn't important but it doesn't work when you put it all on one line.
    – smeier_ec
    Apr 7, 2021 at 12:04
  • 1
    Echoing @smeier_ec comment about 2 lines required. Many other places online include this as a single line or omit the .exe file, this is the only one that has worked! May 10, 2021 at 21:03
100

I got it resolved by adding the vm parameters in the Eclipse configuration file at the top.

Enter image description here

In text format

-vm
C:\Program Files\Java\jdk-11.0.9\bin\javaw.exe
-startup
plugins/org.eclipse.equinox.launcher_1.5.800.v20200727-1323.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.1300.v20200819-0940
-product
org.eclipse.epp.package.jee.product
-showsplash
org.eclipse.epp.package.common
--launcher.defaultAction
openFile
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=11
[email protected]/eclipse-workspace
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-Dosgi.requiredJavaVersion=11
-Dosgi.dataAreaRequiresExplicitInit=true
-Xms256m
-Xmx2048m
--add-modules=ALL-SYSTEM
5
  • Can you provide it as text instead of a screenshot, please? Feb 3, 2022 at 1:45
  • @PeterMortensen updated the config text
    – Napolean
    Feb 3, 2022 at 6:11
  • Sadly did not work for me. :(
    – lurker
    Mar 4, 2022 at 0:20
  • at the top of WHAT? EDIT: To future people "Get-ChildItem -Path . -Filter "eclipse.ini" -Recurse" if you are on windows. Feb 23 at 5:33
  • Steps to resolve the JVM version not suitable for Eclipse. Do check this: paulsofts.com/…
    – paul035
    Oct 20 at 15:24
30

This works for me. Make sure you add -vm(Path_Of_Jdk) on top of -vmargs of eclipse.ini

E.g.,

-vm
C:\Program Files\Java\jdk-11.0.10\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=11
1
  • 2
    this is the correct answer. because the question says it WANTs to use java 11. not to make eclipse work with java 1.8.
    – mostafa.S
    Apr 17, 2021 at 6:56
26

I was getting this error on a Linux OS, but the following solution should work for all OSes.

Step 1: Open a command prompt

Type: java -version

You will see something like this -

openjdk version "1.8.0_275"
OpenJDK Runtime Environment (build 1.8.0_275-8u275-b01-0ubuntu1~16.04-b01)
OpenJDK 64-Bit Server VM (build 25.275-b01, mixed mode)
(may vary depending on your computer and OS)

Step 2: open the eclipse.ini file

The file is located at C:\Users\Yourusername\eclipse\java-2019-12\eclipse

Locate the following line -

-Dosgi.requiredJavaVersion=11

Change it to

-Dosgi.requiredJavaVersion=1.8

and restart Eclipse. It is there twice so change at both places. You may try to give the Java version specific to your system (from the output of step 1). This has worked for me.

5
  • 13
    With Eclipse version 12-2020, this didn't work for me, after showing the launch window I got an error An error has occurred. See the log file /Applications/Eclipse.app/Contents/Eclipse/configuration/1608542182018.log.
    – KhogaEslam
    Dec 21, 2020 at 9:17
  • 1
    Hi @KhogaEslam - Did you get a chance to check the log? What was the error? Did you get this error on Windows or Linux?
    – 3AK
    Dec 22, 2020 at 14:35
  • 1
    I just installed the new version that includes the JRE.
    – KhogaEslam
    Dec 22, 2020 at 16:10
  • Yep. This fix worked for me, on Windows 10.
    – Tihamer
    Feb 8, 2022 at 23:27
  • But the problem is, the original requirement is 1.8. How is it changed to be 11?
    – Ming Leung
    Feb 28, 2022 at 1:24
15

To resolve the incompatible JVM Exception, specify the specific JVM for Eclipse.

  1. Open the eclipse folder and look for the eclipse.ini file.
  2. Before the -vmargs option, add the -vm option.
  3. Find and copy the path of the javaw.exe file in the JDK folder
  4. In the eclipse.ini file, add the path of the javaw.exe file to the new line following the -vm option.
  5. Restart Eclipse after saving the eclipse.ini file.

As a result, the eclipse.ini file looks like this:

-startup
plugins/org.eclipse.equinox.launcher_1.6.200.v20210416-2027.jar
--launcher.library
C:\Users\Admin\.p2\pool\plugins\org.eclipse.equinox.launcher.win32.win32.x86_64_1.2.200.v20210429-1609
-product
org.eclipse.epp.package.java.product
-showsplash
C:\Users\Admin\.p2\pool\plugins\org.eclipse.epp.package.common_4.20.0.20210612-1200
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vm                                          //NEW
C:\Program Files\Java\jdk-16\bin\javaw.exe   //NEW
-vmargs
-Dosgi.requiredJavaVersion=11
[email protected]/eclipse-workspace
-Dsun.java.command=Eclipse
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-Dosgi.requiredJavaVersion=11
-Dosgi.dataAreaRequiresExplicitInit=true
-Dorg.eclipse.swt.graphics.Resource.reportNonDisposed=true
-Xms256m
-Xmx2048m
--add-modules=ALL-SYSTEM
-Declipse.p2.max.threads=10
-Doomph.update.url=http://download.eclipse.org/oomph/updates/milestone/latest
-Doomph.redirection.index.redirection=index:/->http://git.eclipse.org/c/oomph/org.eclipse.oomph.git/plain/setups/
1
  • how come your eclipse.ini has path to jdk-16 but requiredJavaVersion is set to 11?
    – pixel
    Jul 19, 2021 at 17:51
7

I had the same issue and got it to work by reinstalling using the installer from https://www.eclipse.org/downloads/ which includes a JRE.

2
  • All the other answers did not solve this problem for me - this was the only way.
    – olivmir
    Dec 18, 2020 at 8:41
  • Please note, if you have got multiple versions of JAVA installed on Windows, and you use the Eclipse installer, the right version might not be preselected. In my case 11.0.9 was preselected in the dropdown, which gives the erroneous message. Just select a higher version.
    – RWC
    Jul 6, 2022 at 20:54
6

I had the same problem and I downloaded another version of Java EE Eclipse. I got the Eclipse 2020-06 (4.16):

https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/2020-06/R/eclipse-jee-2020-06-R-win32-x86_64.zip

After downloading it, it worked.

1
5

I had the same issue and the following easy steps fixed the issue

Step - 1

Go to the file location of the eclipse and open eclipse.ini in editable format

Step - 2

Go to the java folder location where you find javaw.exe
In my case : C:\Program Files\Java\jdk-11.0.11\bin\javaw.exe

Step - 3

Then paste the following before tag -vmargs inside eclipse.ini file

-vm
C:\Program Files\Java\jdk-11.0.11\bin\javaw.exe

The below image shows in brief

enter image description here

3

For MacOS users:

If you see this error but already have version 11 or greater, you need to specify your jdk bin folder in .ini file.

I observed this error for Eclipse Mat(Memory Analyzer), I guess this procedure is similar for Eclipse IDE.

Follow these steps to find .ini file (You need to find/know your jdk bin folder before these steps!)

  • Go to Applications folder
  • Right click on application and click on "Show Package Contents"
  • Go to Contents/Eclipse
  • Open MemoryAnalyzer.ini with a text editor
  • Find "-vmargs" in MemoryAnalyzer.ini
  • Add this before "-vmargs"
-vm
/Library/Java/JavaVirtualMachines/jdk-11.0.12.jdk/Contents/Home/bin
  • You can start your application after saving changes in .ini file.
2

I had the same problem. Uninstall Java from the control panel and restart your IDE (Eclipse or IntelliJ IDEA).

2
  • 1
    It's true. I had two versions of java and after I remove the old one, the problem disappeared. Nov 3, 2020 at 11:16
  • There are better solutions than this.
    – Stephen C
    Apr 19, 2021 at 7:51
2

I found this topic while having this issue starting dBeaver on Manjaro/Arch Linux with the same error. All provided suggestions did not work in my case.

My solution was to set the JVM as per this post on the Manjaro Forum:

  1. checked the installed versions

    ls /usr/lib/jvm

  2. set latest version (16 in my case)

    sudo archlinux-java set java-16-jdk

1

I downloaded JDK from https://www.oracle.com/java/technologies/javase-jdk15-downloads.html and put the unpacked contents to jre subdirectory of Eclipse's installation path - there is a path eclipse/jre/bin/javaw.exe. Eclipse picks it up automatically over any other installation.

1
  • I put this right before "-vmargs" section
    – hakkican
    Jan 20, 2022 at 8:35
1

Window => Preferences => Java => Installed JREs => Add
(browse for AdoptOpenJdk 11) as shown in picture Mark as default (Only Select this Version => Apply => Save)

enter image description here

1

I also faced the same issue, but I did not resolve it no matter what.

Then it got resolved installing the below link.

https://www.eclipse.org/downloads/download.php?file=/oomph/epp/2020-09/R/eclipse-inst-jre-win64.exe

Enter image description here

1
1

Just add the text above the -startup in C:\Users\username\eclipse\java-2022-09\eclipse\eclipse.ini

-vm
C:\Program Files\Java\jdk-19\bin\javaw.exe
-startup
plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar

This change worked for me

0

For Ubuntu users, refer to the answer https://stackoverflow.com/a/64049648/14489697 by howlger. Add the following lines in file eclipse.ini before -vmargs:

-vm
/usr/lib/jvm/adoptopenjdk-14-openj9-amd64/bin/java

Above is the Java install location. Change this according to yours.

I'm using,

  • Eclipse IDE for Enterprise Java Developers (includes Incubating components)
  • Version: 2020-12 (4.18.0)
  • Build id: 20201210-1552
  • OS: Linux, v.5.4.0-42-generic, x86_64 / gtk 3.22.30
  • Java version: 14.0.2
0

If you're looking to resolve this without changing eclipse.ini file, just reinstall eclipse IDE. It can be the same version or newer one. I have reinstalled the same version and it's worked without issues, no needing of changing eclipse.ini.

0

Thank you . This one worked for me -vm
C:\Program Files\Java\jdk-16\bin\javaw.exe added these lines in eclipse.ini file

1
0

Adding an additional answer here as I was not able to start my eclipse even after updating the eclipse.ini file with the path of javaw.exe under the JDK. I was running into an exception that started as

Java was started but returned exit code=1

I had to point to the java.dll file as suggested in https://wiki.eclipse.org/Eclipse.ini#-vm_value:_Windows_Example. So my latest eclipse.ini looked like

-vm 
C:\Program Files\Eclipse Adoptium\jre-11.0.14.101-hotspot\bin\server\jvm.dll

Also, when I installed JDK 11 it did not come with JRE. I had to download the JRE separately from https://adoptium.net/releases.html?variant=openjdk11&jvmVariant=hotspot

Hope someone finds this useful.

0

Check out your java version and update path and version... echo %JAVA_HOME%\bin\javaw.exe C:\Program Files\Java\jdk-18.0.1.1\bin\javaw.exe

-vm C:\Program Files\Java\jdk-18.0.1.1\bin\javaw.exe -vmargs -Dosgi.requiredJavaVersion=18

0

I just updated the java 11 path in system environmental variables and able to open my eclipse. My eclipse version is 2021-12 (4.22.0)

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