简体   繁体   English

Eclipse - “不兼容 JVM。JVM 的版本 1.8.0_261 不适用于此产品。需要版本:11 或更高版本”

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

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.我刚刚下载了 Eclipse 作为存档并安装了最新的 64 位 Java 和 64 位 Java 开发套件 15。我收到了这个错误。 I installed JDK 11 after and got the same error.之后我安装了 JDK 11 并得到了同样的错误。

How can I make this work?我怎样才能使这项工作?

The Java to run Eclipse can be specified in the eclipse.ini file (see Eclipse wiki: eclipse.ini - Specifying the JVM ).可以在eclipse.ini文件中指定运行 Eclipse 的 Java (请参阅Eclipse wiki:eclipse.ini - 指定 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:-vmargs行之前直接添加以下两行,并将路径调整为 Java 11 或更高版本的 64 位 Java VM 安装目录:

-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 ).或者,您可以将 Java VM 放入 Eclipse 安装的jre子目录中,或者,如果您不安装 Eclipse 但对其进行升级,则在从Eclipse JustJ升级之前安装 Java 11 或更好的 Java 14 作为插件(使用JustJ OpenJDK Hotspot JRE Complete ,而不是BaseMinimal )。

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 11 或更高版本运行 Eclipse, Eclipse 2020-09 (4.17) 仍然支持在 Java 14、13、12、11、10、9、8 甚至更早的版本(低至 Java 1.1)。 Java 15 can be installed via Marketplace . Java 15 可以通过 Marketplace 安装

I got it resolved by adding the vm parameters in the Eclipse configuration file at the top.我通过在顶部的 Eclipse 配置文件中添加 vm 参数来解决它。

在此处输入图像描述

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

This works for me.这对我有用。 Make sure you add -vm(Path_Of_Jdk) on top of -vmargs of eclipse.ini确保在eclipse.ini-vmargs之上添加-vm(Path_Of_Jdk)

Eg,例如,

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

I was getting this error on a Linux OS, but the following solution should work for all OSes.我在Linux操作系统上遇到此错误,但以下解决方案应该适用于所有操作系统。

Step 1: Open a command prompt步骤 1:打开命令提示符

Type: java -version类型: 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第二步:打开eclipse.ini文件

The file is located at C:\Users\Yourusername\eclipse\java-2019-12\eclipse该文件位于 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.并重新启动 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).您可以尝试提供特定于您系统的 Java 版本(来自步骤 1 的输出)。 This has worked for me.这对我有用。

To resolve the incompatible JVM Exception, specify the specific JVM for Eclipse.要解决不兼容的 JVM 异常,请为 Eclipse 指定特定的 JVM。

  1. Open the eclipse folder and look for the eclipse.ini file.打开 eclipse 文件夹并查找eclipse.ini文件。
  2. Before the -vmargs option, add the -vm option.-vmargs选项之前,添加-vm选项。
  3. Find and copy the path of the javaw.exe file in the JDK folder找到并复制JDK文件夹中javaw.exe文件的路径
  4. In the eclipse.ini file, add the path of the javaw.exe file to the new line following the -vm option.eclipse.ini文件中,将javaw.exe文件的路径添加到-vm选项后面的新行中。
  5. Restart Eclipse after saving the eclipse.ini file.保存eclipse.ini文件后重新启动 Eclipse。

As a result, the eclipse.ini file looks like this:结果, 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                                          //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/

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

I had the same problem and I downloaded another version of Java EE Eclipse.我遇到了同样的问题,我下载了另一个版本的 Java EE Eclipse。 I got the Eclipse 2020-06 (4.16):我得到了 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 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.下载后,它工作。

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 .我从https://www.oracle.com/java/technologies/javase-jdk15-downloads.html下载了 JDK,并将解压后的内容放到 Eclipse 安装路径的jre子目录中——有一个路径eclipse/jre/bin/javaw.exe Eclipse picks it up automatically over any other installation. Eclipse 会自动选择它而不是任何其他安装。

I had the same problem.我有同样的问题。 Uninstall Java from the control panel and restart your IDE ( Eclipse or IntelliJ IDEA ).从控制面板卸载 Java 并重新启动 IDE( EclipseIntelliJ IDEA )。

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 https://www.eclipse.org/downloads/download.php?file=/oomph/epp/2020-09/R/eclipse-inst-jre-win64.exe

在此处输入图像描述

Window => Preferences => Java => Installed JREs => Add窗口 => 首选项 => Java => 已安装的 JRE => 添加
(browse for AdoptOpenJdk 11) as shown in picture Mark as default (Only Select this Version => Apply => Save) (浏览 AdoptOpenJdk 11)如图 标记为默认(仅选择此版本 => 应用 => 保存)

在此处输入图像描述

I found this topic while having this issue starting dBeaver on Manjaro / Arch Linux with the same error.我在Manjaro / Arch Linux上启动dBeaver时遇到了这个问题,但出现了同样的错误。 All provided suggestions did not work in my case.所有提供的建议都不适用于我的情况。

My solution was to set the JVM as per this post on the Manjaro Forum :我的解决方案是根据 Manjaro 论坛上的这篇文章设置 JVM:

  1. checked the installed versions检查已安装的版本

    ls /usr/lib/jvm

  2. set latest version (16 in my case)设置最新版本(在我的情况下为 16)

    sudo archlinux-java set java-16-jdk

I had the same issue and the following easy steps fixed the issue我有同样的问题,以下简单的步骤解决了这个问题

Step - 1步骤1

Go to the file location of the eclipse and open eclipse.ini in editable format转到eclipse的文件位置并以可编辑格式打开eclipse.ini

Step - 2第2步

Go to the java folder location where you find javaw.exe转到找到 javaw.exe 的 java 文件夹位置
In my case : C:\Program Files\Java\jdk-11.0.11\bin\javaw.exe就我而言: C:\Program Files\Java\jdk-11.0.11\bin\javaw.exe

Step - 3步骤 - 3

Then paste the following before tag -vmargs inside eclipse.ini file然后在eclipse.ini文件中的标记-vmargs之前粘贴以下内容

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

The below image shows in brief下图简要显示

在此处输入图像描述

Just add the text above the -startup in C:\Users\username\eclipse\java-2022-09\eclipse\eclipse.ini只需在 C 中的-startup上方添加文本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这个改变对我有用

For Ubuntu users, refer to the answer https://stackoverflow.com/a/64049648/14489697 by howlger.对于 Ubuntu 用户,请参阅 howlger 的答案https://stackoverflow.com/a/64049648/14489697 Add the following lines in file eclipse.ini before -vmargs :在文件eclipse.ini-vmargs之前添加以下行:

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

Above is the Java install location.以上是Java安装位置。 Change this according to yours.根据你的改变这个。

I'm using,我在用着,

  • Eclipse IDE for Enterprise Java Developers (includes Incubating components)面向企业 Java 开发人员的 Eclipse IDE(包括孵化组件)
  • Version: 2020-12 (4.18.0)版本:2020-12 (4.18.0)
  • Build id: 20201210-1552版本号:20201210-1552
  • OS: Linux, v.5.4.0-42-generic, x86_64 / gtk 3.22.30操作系统:Linux,v.5.4.0-42-generic,x86_64 / gtk 3.22.30
  • Java version: 14.0.2 Java版本:14.0.2

If you're looking to resolve this without changing eclipse.ini file , just reinstall eclipse IDE.如果您希望在不更改 eclipse.ini 文件的情况下解决此问题,只需重新安装 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.我已经重新安装了相同的版本,它没有问题,不需要更改 eclipse.ini。

Thank you .谢谢你 。 This one worked for me -vm这个对我有用-vm
C:\Program Files\Java\jdk-16\bin\javaw.exe added these lines in eclipse.ini file C:\Program Files\Java\jdk-16\bin\javaw.exe 在 eclipse.ini 文件中添加了这些行

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.在这里添加一个额外的答案,因为即使在使用 JDK 下的 javaw.exe 路径更新 eclipse.ini 文件后,我也无法启动我的 eclipse。 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 inhttps://wiki.eclipse.org/Eclipse.ini#-vm_value:_Windows_Example .我必须按照https://wiki.eclipse.org/Eclipse.ini#-vm_value:_Windows_Example中的建议指向 java.dll 文件。 So my latest eclipse.ini looked like所以我最新的 eclipse.ini 看起来像

-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.此外,当我安装 JDK 11 时,它并没有随 JRE 一起提供。 I had to download the JRE separately from https://adoptium.net/releases.html?variant=openjdk11&jvmVariant=hotspot我必须从https://adoptium.net/releases.html?variant=openjdk11&jvmVariant=hotspot单独下载 JRE

Hope someone finds this useful.希望有人觉得这很有用。

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检查您的 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 -vm C:\Program Files\Java\jdk-18.0.1.1\bin\javaw.exe -vmargs -Dosgi.requiredJavaVersion=18

For MacOS users:对于 MacOS 用户:

If you see this error but already have version 11 or greater, you need to specify your jdk bin folder in.ini file.如果您看到此错误但已经有版本 11 或更高版本,则需要在 .ini 文件中指定您的 jdk bin 文件夹。

I observed this error for Eclipse Mat(Memory Analyzer), I guess this procedure is similar for Eclipse IDE.我观察到 Eclipse Mat(内存分析器)的这个错误,我猜这个过程类似于 Eclipse IDE。

Follow these steps to find.ini file (You need to find/know your jdk bin folder before these steps!)按照以下步骤查找.ini 文件(在这些步骤之前,您需要找到/知道您的 jdk bin 文件夹!)

  • Go to Applications folder Go 到应用程序文件夹
  • Right click on application and click on "Show Package Contents"右键单击应用程序,然后单击“显示 Package 内容”
  • Go to Contents/Eclipse Go 到目录/Eclipse
  • Open MemoryAnalyzer.ini with a text editor使用文本编辑器打开 MemoryAnalyzer.ini
  • Find "-vmargs" in MemoryAnalyzer.ini在 MemoryAnalyzer.ini 中找到“-vmargs”
  • Add this before "-vmargs"在“-vmargs”之前添加这个
-vm
/Library/Java/JavaVirtualMachines/jdk-11.0.12.jdk/Contents/Home/bin
  • You can start your application after saving changes in.ini file.您可以在.ini 文件中保存更改后启动您的应用程序。

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

I just downloaded Eclipse as archive, and installed newest 64 bit Java and 64 bit Java Development Kit 15. And i get this error.我刚刚下载了Eclipse作为存档,并安装了最新的64位Java和64位Java Development Kit 15。 Installed JDK 11 after, the same error.安装完JDK 11之后,出现同样的错误。

How can I make this work?我该如何进行这项工作?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM