Eclipse – "Incompatible JVM. Version 1.8.0_261 of the JVM is not suitable for this product. Version: 11 or greater is required"

huangapple go评论63阅读模式
英文:

Eclipse - "Incompatible JVM. Version 1.8.0_261 of the JVM is not suitable for this product. Version: 11 or greater is required"

问题

我刚刚下载了Eclipse的压缩文件,并安装了最新的64位Java和64位Java Development Kit 15。然后我遇到了这个错误。我之后安装了JDK 11,仍然得到了相同的错误。

我该如何解决这个问题?

英文:

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?

答案1

得分: 206

以下是翻译好的内容:

Java运行Eclipse 可以在 eclipse.ini 文件中指定(参见 Eclipse维基: eclipse.ini - 指定JVM)。在 -vmargs 行之前直接添加以下两行,并将路径适配为你的 Java 11 或更高版本的64位 Java VM 安装目录:

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

或者,你可以将 Java VM 放入 Eclipse 安装目录的 jre 子目录中。如果你不安装 Eclipse 而是升级它,在从 Eclipse JustJ 进行升级之前,将 Java 11 或更好的 Java 14 安装为插件(使用 JustJ OpenJDK Hotspot JRE Complete,而不是 BaseMinimal)。

请注意,即使你使用 Java 11 或更高版本运行 Eclipse,Eclipse 2020-09 (4.17) 仍支持在 Java 14、13、12、11、10、9、8 甚至更早的版本中进行编码(最低支持到 Java 1.1)。Java 15 可以通过 Marketplace 安装

英文:

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.

答案2

得分: 96

我通过在Eclipse配置文件顶部添加虚拟机参数来解决了这个问题。

Eclipse – "Incompatible JVM. Version 1.8.0_261 of the JVM is not suitable for this product. Version: 11 or greater is required"

以文本格式

-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
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-Dosgi.requiredJavaVersion=11
-Dosgi.dataAreaRequiresExplicitInit=true
-Xms256m
-Xmx2048m
--add-modules=ALL-SYSTEM
英文:

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

Eclipse – "Incompatible JVM. Version 1.8.0_261 of the JVM is not suitable for this product. Version: 11 or greater is required"

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
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-Dosgi.requiredJavaVersion=11
-Dosgi.dataAreaRequiresExplicitInit=true
-Xms256m
-Xmx2048m
--add-modules=ALL-SYSTEM

答案3

得分: 30

这对我来说是有效的。确保你在eclipse.ini-vmargs之前加入-vm(Path_Of_Jdk)

例如,

-vm
C:\Program Files\Java\jdk-11.0.10\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=11
英文:

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

答案4

得分: 25

我在Linux操作系统上遇到了这个错误,但是以下的解决方案适用于所有操作系统。

步骤1: 打开命令提示符

输入:java -version

你会看到类似这样的输出 -

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)
(根据你的计算机和操作系统可能会有所不同)

步骤2: 打开 eclipse.ini 文件

该文件位于 C:\Users\Yourusername\eclipse\java-2019-12\eclipse

找到下面这行 -

-Dosgi.requiredJavaVersion=11

将其修改为

-Dosgi.requiredJavaVersion=1.8

然后重新启动 Eclipse。这一行在文件中出现了两次,所以要在两个地方都修改。你可以尝试根据步骤1的输出给出适合你系统的Java版本。这对我有效。

英文:

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

得分: 15

解决不兼容的JVM异常,请指定Eclipse使用特定的JVM。

  1. 打开eclipse文件夹,找到 eclipse.ini 文件。
  2. -vmargs 选项之前,添加 -vm 选项。
  3. 在JDK文件夹中找到并复制 javaw.exe 文件的路径。
  4. eclipse.ini 文件中,在 -vm 选项后添加 javaw.exe 文件的路径。
  5. 保存 eclipse.ini 文件后,重新启动Eclipse。

结果,eclipse.ini 文件如下所示:

-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                                          //新添加
C:\Program Files\Java\jdk-16\bin\javaw.exe   //新添加
-vmargs
-Dosgi.requiredJavaVersion=11
-Dosgi.instance.area.default=@user.home/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/
英文:

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
-Dosgi.instance.area.default=@user.home/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/

答案6

得分: 7

我遇到了相同的问题,并通过使用来自 https://www.eclipse.org/downloads/ 的安装程序重新安装,其中包括了一个 JRE,使其正常工作。

英文:

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.

答案7

得分: 6

我遇到了相同的问题,然后我下载了另一个版本的Java EE Eclipse。我得到了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

下载完成后,它正常工作了。

英文:

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.

答案8

得分: 5

我遇到了相同的问题,以下简单的步骤解决了这个问题

步骤一

前往 Eclipse 的文件位置,以可编辑格式打开 eclipse.ini 文件

步骤二

前往 Java 文件夹的位置,您会找到 javaw.exe 文件<br>
在我的情况下:C:\Program Files\Java\jdk-11.0.11\bin\javaw.exe

步骤三

然后在 eclipse.ini 文件的 -vmargs 标签之前插入以下内容

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

下面的图片简要显示了这一步骤

Eclipse – "Incompatible JVM. Version 1.8.0_261 of the JVM is not suitable for this product. Version: 11 or greater is required"

英文:

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

Eclipse – "Incompatible JVM. Version 1.8.0_261 of the JVM is not suitable for this product. Version: 11 or greater is required"

答案9

得分: 3

对于 MacOS 用户:

如果您看到此错误但已经安装了 11 版本或更高版本,则需要在 .ini 文件中指定您的 JDK 二进制文件夹。

我在 Eclipse Mat(内存分析器)中观察到了这个错误,我猜这个步骤对于 Eclipse IDE 也是类似的。

按照以下步骤查找 .ini 文件(在执行这些步骤之前,您需要找到/知道您的 JDK 二进制文件夹!)

  • 进入 Applications 文件夹
  • 右键单击应用程序,然后点击 "Show Package Contents"
  • 进入 Contents/Eclipse
  • 用文本编辑器打开 MemoryAnalyzer.ini
  • 在 MemoryAnalyzer.ini 中找到 "-vmargs"
  • 在 "-vmargs" 之前添加以下内容:
-vm
/Library/Java/JavaVirtualMachines/jdk-11.0.12.jdk/Contents/Home/bin
  • 在保存 .ini 文件的更改后,您可以启动应用程序。
英文:

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.

答案10

得分: 2

我在启动 dBeaver 时遇到了相同的错误,在 Manjaro/Arch Linux 上遇到了这个问题。所有提供的建议在我的情况下都没有起作用。

我的解决方案是根据这个 在 Manjaro 论坛上的帖子 来设置 JVM:

  1. 检查已安装的版本

    ls /usr/lib/jvm

  2. 设置最新的版本(在我的情况下是 16)

    sudo archlinux-java set java-16-jdk

英文:

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

答案11

得分: 1

我从https://www.oracle.com/java/technologies/javase-jdk15-downloads.html 下载了JDK,并将解压后的内容放到Eclipse安装路径的jre子目录中 - 路径为eclipse/jre/bin/javaw.exe。Eclipse会自动优先选择它,而不是其他安装。

英文:

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.

答案12

得分: 1

我遇到了同样的问题。从控制面板中卸载 Java,然后重新启动你的 IDE(Eclipse 或者 IntelliJ IDEA)。

英文:

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

答案13

得分: 1

我也遇到了相同的问题,但无论如何都没有解决。

后来通过安装以下链接来解决了。

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

Eclipse – "Incompatible JVM. Version 1.8.0_261 of the JVM is not suitable for this product. Version: 11 or greater is required"

英文:

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

Eclipse – "Incompatible JVM. Version 1.8.0_261 of the JVM is not suitable for this product. Version: 11 or greater is required"

答案14

得分: 1

&gt;  窗口 =&gt; 首选项 =&gt; Java =&gt; 已安装的 JRE =&gt; 添加  
&gt;     (浏览 AdoptOpenJdk 11,如图所示)
&gt;     标记为默认(仅选择此版本 =&gt; 应用 =&gt; 保存)

[![在此输入图片描述][1]][1]

  [1]: https://i.stack.imgur.com/1C4EK.png
英文:

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

Eclipse – "Incompatible JVM. Version 1.8.0_261 of the JVM is not suitable for this product. Version: 11 or greater is required"

答案15

得分: 1

只需将文本添加到 C:\Users\username\eclipse\java-2022-09\eclipse\eclipse.ini-startup 上方即可:

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

这个变更对我起了作用。

英文:

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

答案16

得分: 0

对于Ubuntu用户,请参考答案 https://stackoverflow.com/a/64049648/14489697 由用户 howlger 提供。在文件 eclipse.ini-vmargs 之前添加以下行:

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

上面是Java的安装路径。根据您的情况进行更改。

我正在使用:

  • Eclipse IDE 用于企业级Java开发人员(包括孵化组件)
  • 版本:2020-12(4.18.0)
  • 构建编号:20201210-1552
  • 操作系统:Linux,v.5.4.0-42-generic,x86_64 / gtk 3.22.30
  • Java版本:14.0.2
英文:

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

答案17

得分: 0

如果您希望在不更改eclipse.ini文件的情况下解决这个问题,只需重新安装eclipse IDE。可以是相同版本或更新版本。
我已经重新安装了相同版本,它可以在无需更改eclipse.ini的情况下正常工作。

英文:

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.

答案18

得分: 0

谢谢。
这个方法对我有用。
-vm
C:\Program Files\Java\jdk-16\bin\javaw.exe
在eclipse.ini文件中添加了这些行。

英文:

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

答案19

得分: 0

添加以下额外答案,因为即使在将eclipse.ini文件更新为JDK下javaw.exe路径后,我仍无法启动Eclipse。我遇到了一个异常,起初是这样的:

Java was started but returned exit code=1

根据https://wiki.eclipse.org/Eclipse.ini#-vm_value:_Windows_Example的建议,我不得不指向java.dll文件。所以,我最新的eclipse.ini看起来像这样:

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

另外,当我安装JDK 11时,它并没有附带JRE。我不得不从https://adoptium.net/releases.html?variant=openjdk11&jvmVariant=hotspot单独下载JRE。

希望有人会发现这个有用。

英文:

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&amp;jvmVariant=hotspot

Hope someone finds this useful.

答案20

得分: 0

检查你的Java版本以及更新路径和版本...
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

英文:

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

答案21

得分: 0

我刚刚更新了系统环境变量中的Java 11路径,现在可以打开我的Eclipse。我的Eclipse版本是2021-12(4.22.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)

huangapple
  • 本文由 发表于 2020年9月22日 00:07:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/63996047.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定