Java Eclipse:指定的 JRE 安装不存在

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26477692/
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-11 02:35:55  来源:igfitidea点击:

Eclipse: The specified JRE installation does not exist

javaandroideclipsemacososx-yosemite

提问by Fisher Coder

I used to have Eclipse configured well and work fine before. But I just uninstalled it and installed Eclipse Juno again on my Mac OS 10.10 today. But I kept getting this error: "The specified JRE does not exist."

我曾经将 Eclipse 配置得很好并且以前工作得很好。但是我今天刚刚卸载它并在我的 Mac OS 10.10 上再次安装了 Eclipse Juno。但是我一直收到这个错误:“指定的 JRE 不存在。”

I know it's a pretty simple and commonly seen problem, I just needed to install JRE and/or JDK into this clean Eclipse, however things didn't get work out.

我知道这是一个非常简单且常见的问题,我只需要将 JRE 和/或 JDK 安装到这个干净的 Eclipse 中,但是事情并没有解决。

And I've searched extensively on Stack Overflow: The posts I've looked at including: How to install JRE 1.7 on Mac OS X and use it with Eclipse?I followed exactly what the accepted answer said, but after having downloaded the JDK from http://www.oracle.com/technetwork/java/javase/downloads/index.htmland installed it, I was going to add it to Eclipse via Preferences -> Java -> Installed JREs, however, I didn't see it as expected, the following is a screenshot of what I saw when I went to Preferences -> Java -> Installed JREs

我在 Stack Overflow 上进行了广泛的搜索:我看过的帖子包括: How to install JRE 1.7 on Mac OS X and use it with Eclipse?我完全遵循了接受的答案所说的内容,但是在从http://www.oracle.com/technetwork/java/javase/downloads/index.html下载了 JDK并安装之后,我打算通过Preferences -> Java -> Installed JREs,然而,我并没有像预期的那样看到,下面是我在 Preferences -> Java -> Installed JREs 看到的截图

enter image description here

在此处输入图片说明

But the screenshot just says the installed JREs list is BLANK, I couldn't add any JRE into my Eclipse.

但是屏幕截图只是说已安装的 JRE 列表是空白的,我无法将任何 JRE 添加到我的 Eclipse 中。

Help please?

请帮忙?

Also, I've tried other things that people have suggested: Properties -> Java Build Path what I see here is: JRE System Library OSGi/Minimum-1.2 with a red crossing sign in front of it (indicating something wrong with it?) So, I'm also blocked with this approach.

另外,我尝试了人们建议的其他内容:属性 -> Java 构建路径我在这里看到的是:JRE 系统库 OSGi/Minimum-1.2 前面有一个红色十字符号(表示它有问题?)所以,我也被这种方法阻止了。

enter image description here

在此处输入图片说明

采纳答案by FunctionR

I had the same problem. This is how I fixed it.

我有同样的问题。这就是我修复它的方式。

  1. Open Eclipse.
  2. Go to Preferences.
  3. Click Add
  4. A Window should popup with this:
  1. 打开日食。
  2. Preferences
  3. 点击 Add
  4. 应该弹出一个窗口:

enter image description here

在此处输入图片说明

  1. Select Standard VM.
  2. Select Directory
  3. Use this path: Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/
  4. Click Open
  5. Then Finish
  6. Right click your Project then click Properties
  7. Select Java Build Paththen click Add Library
  8. Select JRE System Library
  1. 选择Standard VM
  2. 选择 Directory
  3. 使用此路径: Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/
  4. 点击 Open
  5. 然后 Finish
  6. 右键单击您的项目,然后单击 Properties
  7. 选择Java Build Path然后点击Add Library
  8. 选择 JRE System Library

enter image description here

在此处输入图片说明

  1. Click Environmentsand select the jdk1.7.0_45
  2. Finish
  1. 单击Environments并选择jdk1.7.0_45
  2. Finish

This is what you should see if you did it right:

如果你做对了,这就是你应该看到的

enter image description here

在此处输入图片说明

回答by Andreas Dietrich

The problem is generally related to project or plugin-specific runtime configurationsthat (still) point to some JDK/JRE that is not existing anymore (e.g. after some update or migration).

该问题通常与项目或特定于插件的运行时配置有关,这些配置(仍然)指向某些不再存在的 JDK/JRE(例如,在某些更新或迁移之后)。

We had this e.g.with the ANTplugin, where the launch configurationhad to be updated (per ant build file), if it was e.g. not set to the default ~ run in same JRE as workspace.

我们有这个例如ANT插件,在启动配置必须更新(每Ant构建文件),如果它例如,不设置为默认值~ run in same JRE as workspace

You will find these settings (typicall under the JREtab) either:

您将找到这些设置(通常在JRE选项卡下)

  1. in the global plugin configuration under Eclipse -> Window -> Preferences -> ...of your plugin(typing runtimein the Filtersection above may help to find it quickly).

  2. or it is set in a project/file-specificrun configuration which you should see if you go to

    • Eclipse -> Run -> Run configurations...or
    • right click on your project/file and select Run As -> Run Configurations ...
  3. or it is set in a project/file-specificexternal tool configuration (e.g. like used by ANT) which is similarly to be found here:

    • Eclipse -> Run -> External Tools -> External Tools Configuration ...or
    • right click on your project/file and select Run As -> External Tool Configurations ...
  1. 插件下Eclipse -> Window -> Preferences -> ...全局插件配置runtimeFilter上面的部分中输入可能有助于快速找到它)。

  2. 或者它被设置在一个项目/文件特定的运行配置中,如果你去,你应该看到

    • Eclipse -> Run -> Run configurations...或者
    • 右键单击您的项目/文件并选择 Run As -> Run Configurations ...
  3. 或者它被设置在一个项目/文件特定的外部工具配置中(例如像 ANT 使用的那样),类似于这里:

    • Eclipse -> Run -> External Tools -> External Tools Configuration ...或者
    • 右键单击您的项目/文件并选择 Run As -> External Tool Configurations ...

回答by Deeptha AS

I had the same problem. This solution might help fix the issue as it did for me.

我有同样的问题。此解决方案可能有助于解决问题,就像对我一样。

  1. Right click on the project -> Build Path -> Configure Build Path
  2. In the Libraries tab, select JRE System Library and click Edit
  3. In the Edit window you can either select Workspace default JRE or in Execution environment drop down select the JRE installed
  1. 右键项目->构建路径->配置构建路径
  2. 在库选项卡中,选择 JRE 系统库并单击编辑
  3. 在 Edit 窗口中,您可以选择 Workspace default JRE 或在 Execution environment 下拉列表中选择安装的 JRE

回答by Ole V.V.

I had the problem with one particular run configuration (unittests for one project in my case). In Run Configurations, I selected the troubled run configuration, then the JRE tab, and I could see it was broken (even though I couldn't tell how it had happened). Selecting the right JRE solved my problem (project JRE in my case, even though this was just my standard JRE and not configured for the project specifically).

我遇到了一个特定运行配置的问题(在我的例子中是一个项目的单元测试)。在 Run Configurations 中,我选择了有问题的运行配置,然后是 JRE 选项卡,我可以看到它已损坏(即使我不知道它是如何发生的)。选择正确的 JRE 解决了我的问题(在我的例子中是项目 JRE,即使这只是我的标准 JRE 而不是专门为项目配置的)。

回答by dwjohnston

Your run configurations maybe trying to use a specific JRE.

您的运行配置可能会尝试使用特定的 JRE。

enter image description here

在此处输入图片说明

Make sure you are using the correct JRE there.

确保您在那里使用了正确的 JRE。

回答by Phoenix

In eclipse click Window –> Show view –> Servers

在eclipse中点击Window –> Show view –> Servers

Once you are in servers view double click configured server to open its configuration and click Runtime environment link (in the left side).

在服务器视图中双击配置的服务器以打开其配置并单击运行时环境链接(在左侧)。

Select the JRE and click finish.

选择 JRE 并单击完成。

Hope it help you

希望对你有帮助

回答by Muneeb Mirza

This happened to me when I updated Java. Though it was updated in my system, it didn't update the references in eclipse. I was working on web projects so I had to do the following steps

当我更新 Java 时,这发生在我身上。虽然它在我的系统中进行了更新,但它并没有更新 eclipse 中的引用。我正在从事网络项目,所以我必须执行以下步骤

  1. Windows > Preferences > Java > Installed JREs (here the old version was present without showing any error) > Remove any old versions that are not present in your system and Add latest release or the present ones.

  2. Confirm Build Path of your projects and confirm they are pointing at the correct JRE. Project > Build Path > Check JRE version is correct

  1. Windows > 首选项 > Java > 已安装的 JRE(此处存在旧版本而未显示任何错误)> 删除系统中不存在的所有旧版本并添加最新版本或当前版本。

  2. 确认项目的构建路径并确认它们指向正确的 JRE。项目 > 构建路径 > 检查 JRE 版本是否正确

After doing this my project still gave me the same error so I checked JRE for my tomcat servers setup in eclipse

这样做之后,我的项目仍然给了我同样的错误,所以我在 Eclipse 中检查了我的 tomcat 服务器设置的 JRE

  1. Window > Preferences > Server > Runtime Enviroments > Select each server and edit it, reselect the jre and apply (it took me some time here to make eclipse realise i had the correct JRE selected).
  1. Window > Preferences > Server > Runtime Enviroments > 选择每个服务器并编辑它,重新选择 jre 并应用(我在这里花了一些时间让 eclipse 意识到我选择了正确的 JRE)。

Thats it, try running now it it should work.

就是这样,现在尝试运行它应该可以工作。

回答by Abhijit Patra

Main Cause of this Error is You Maybe forgot the set Build patch. When you Import Old Project this time Old Java Build Patch Existing You Have to give New One which one you currently using in your work space.

此错误的主要原因是您可能忘记了设置的构建补丁。当您这次导入旧项目时,旧的 Java 构建补丁已存在,您必须给新的一个您当前在工作空间中使用的补丁。

Process:- Right Click Project -> Build patch -> Configure Build path-> Add Library-> System Library-> Set JRE (Default or Alternative)enter image description here

流程:- 右键项目-> 构建补丁-> 配置构建路径-> 添加库-> 系统库-> 设置JRE(默认或替代)在此处输入图片说明