无法使用 Java 10.0.1 运行 Eclipse

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/50109045/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-10 23:26:45  来源:igfitidea点击:

Can't run Eclipse with Java 10.0.1

javaeclipsejava-10

提问by Stavros Argyrides

I have updated my Java to version 10.0.1and now I can't run Eclipse anymore.

我已将我的 Java 更新到版本10.0.1,现在我无法再运行 Eclipse。

It shows this message:

它显示此消息:

a java runtime environment (JRE) or Java development Kit(jdk) must be available in order to run eclipse. No Java virtual machine was found after searching the following locations:

C:\Program Files\Java\ire1.8.0_144\bin

必须有一个 Java 运行时环境 (JRE) 或 Java 开发工具包 (jdk) 才能运行 eclipse。搜索以下位置后未找到 Java 虚拟机:

C:\Program Files\Java\ire1.8.0_144\bin

I tried from advance settings to insert a new path but doesn't work.

我尝试从高级设置插入新路径,但不起作用。

采纳答案by Zabuzard

Instructions

指示

(ignore that the images don't show Java 10 but Java 9 and 8 instead)

忽略图像不显示 Java 10,而是显示 Java 9 和 8

First step is that you need to download a JDK 10(download). Then set your Windows Pathsystem environment variable to point to the bindirectory of your JDK 10 and remove the entry to the old java version (see the tutorial). Looks like this on my end:

第一步是您需要下载JDK 10下载)。然后将您的 WindowsPath系统环境变量设置为指向binJDK 10的目录并删除旧 Java 版本的条目(请参阅教程)。看起来像这样:

path variable

路径变量

This variable defines where Windows will look for commands. Try it out by typing in java -versioninto your cmd:

此变量定义 Windows 将在哪里查找命令。通过在java -version您的cmd:

command line

命令行

If it reads Java 10it worked.

如果它读取Java 10,则它起作用了。

After that you need to set your Eclipse to Java 10. Therefore, first add the JDK as possible JRE for Eclipse. Go to Window > Preferences > Java > Installed JREsand add it:

之后,您需要将 Eclipse 设置为 Java 10。因此,首先添加 JDK 作为 Eclipse 的 JRE。转到Window > Preferences > Java > Installed JREs并添加它:

eclipse jres

日食

Last step is that you need to tell your project to use this entry now. Go to Properties > Java Build Pathof your project and edit the JRE it uses:

最后一步是你需要告诉你的项目现在使用这个条目。转到Properties > Java Build Path您的项目并编辑它使用的 JRE:

project jre

项目jre



Eclipse and Java 10

Eclipse 和 Java 10

Note that Eclipse does not really supportJava 10 yet.

需要注意的是Eclipse中并没有真正支持的Java 10

Oxygenhas an early draft that supports it, but it may be difficult to get all plugins going. See here.

Oxygen有一个支持它的早期草案,但可能很难让所有插件都运行起来。见这里

Photonwill support it when released in June. The early build of Photon doesn't support it yet. See here.

Photon将在 6 月发布时支持它。Photon 的早期版本尚不支持它。见这里

回答by Bungler

I was able to resolve this issue by updating Eclipse through their installer tool.

我能够通过他们的安装程序工具更新 Eclipse 来解决这个问题。

First of all, try updating the config of your current installation. It's called eclipse.iniand it's going to be in the original installation directory. Mine looks somewhat like this:

首先,尝试更新当前安装的配置。它被调用eclipse.ini,它将位于原始安装目录中。我的看起来有点像这样:

[...]
openFile
--launcher.appendVmargs
-vm
C:\Program Files\Java\jre-10.0.1\bin  <--Change this to the correct JRE path
-vmargs
-Dosgi.requiredJavaVersion=1.8
[...]

If that doesn't work, try:

如果这不起作用,请尝试:

  1. Install JRE 10. Look at the first part of Zabuza's answer for instructions.
  2. Download the Eclipse Installer (http://eclipse.mirror.rafal.ca/oomph/epp/oxygen/R2/eclipse-inst-win64.exe)
  3. Update the installer if it requires one. There will be a notification when you launch it; click it and the installer will update and restart.
  1. 安装 JRE 10。查看Zabuza答案的第一部分以获取说明。
  2. 下载 Eclipse 安装程序 ( http://eclipse.mirror.rafal.ca/oomph/epp/oxygen/R2/eclipse-inst-win64.exe)
  3. 如果需要,请更新安装程序。启动时会有提示;单击它,安装程序将更新并重新启动。

In the next window: enter image description here

在下一个窗口中在此处输入图片说明

  1. Choose a product from the list. I chose one that I already had installed.
  2. Change the Eclipse version if you'd like. I stuck with Oxygen.
  3. Browse to where you installed your jre 10 version and click next.
  1. 从列表中选择一个产品。我选择了一个我已经安装过的。
  2. 如果您愿意,可以更改 Eclipse 版本。我坚持使用氧气。
  3. 浏览到您安装 jre 10 版本的位置,然后单击下一步。

In the next window: enter image description here

在下一个窗口中在此处输入图片说明

  1. Check a project to download if you want. I didn't download any of them. Click next.
  2. Continue through the installation and specify your preference for it's location. I chose to install in the same location. This should not touch any of your project files.
  3. Choose a location for the workspace. I chose the original location.
  4. Eclipse should open with the welcome page. Click File > Open Project from File System, and it will import your project.

  5. You may have to repeat the part at the top and edit the eclipse.iniof at lease check that it is still updated.

  1. 如果需要,请检查要下载的项目。我没有下载任何一个。点击下一步。
  2. 继续安装并指定您对其位置的偏好。我选择安装在同一位置。这不应涉及您的任何项目文件。
  3. 为工作区选择一个位置。我选择了原来的位置。
  4. Eclipse 应该打开欢迎页面。单击文件 > 从文件系统打开项目,它将导入您的项目。

  5. 您可能需要重复顶部的部分并编辑eclipse.ini至少检查它是否仍在更新。