Eclipse IDE - 错误:构建路径指定了执行环境 Java SE 1.7
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26345131/
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
Eclipse IDE - Error: Build path specifies execution environment Java SE 1.7
提问by Srinivas Nani
In Eclipse, I am getting an error:
在 Eclipse 中,我收到一个错误:
Build path specifies execution environment Java SE 1.7.
There are no JREs installed in the workspace that are strictly compatible with this environment.
构建路径指定执行环境 Java SE 1.7。
工作空间中没有安装与此环境严格兼容的 JRE。
回答by kirti
Try this
尝试这个
In Eclipse,
your project
-> properties
-> java build path : Libraries
Remove the "JRE System Library[J2SE 1.4]"
-> click "Add Library" button -> JRE System Library
-> select the new "Executin Environment" or Workspace default JRE
回答by Mark Jeronimus
Sounds like what I had after installing a newer Eclipse.
听起来像我安装较新的 Eclipse 后所拥有的。
My solution:
我的解决方案:
Window->Preferences, Java->Installed JREs->Execution Environment.
Window->Preferences, Java->Installed JREs->Execution Environment。
Click the correct environment in the left panel, probably JavaSE-jre7
在左侧面板中单击正确的环境,可能是 JavaSE-jre7
If the checkbox in the right panel is empty, check it.
如果右侧面板中的复选框为空,请选中它。
If it's checked, but it isn't named jre7 [perfect match]then find the one in the left panel that does have 'perfect match' on the right and check that instead.
如果已选中,但未命名为jre7 [perfect match],则在左侧面板中找到右侧确实具有“perfect match”的那个,然后进行检查。
回答by lazyverve
Go to Project|Properties Choose the Java Build Path section Select the current JRE System Library, and choose Remove Select Add Library, and under the JRE System Library category pick your system library; you probably just need to choose the Workspace default JRE
转到 Project|Properties 选择 Java Build Path 部分 选择当前的 JRE System Library,然后选择 Remove 选择 Add Library,然后在 JRE System Library 类别下选择您的系统库;您可能只需要选择 Workspace 默认 JRE
More generally, under Window|Preferences, you can check Java|Installed JREs|Execution Environments to know which of the installed JREs match a specific execution environment.
更一般地说,在 Window|Preferences 下,您可以检查 Java|Installed JREs|Execution Environments 以了解哪些已安装的 JRE 与特定的执行环境匹配。
回答by vignesh R
Go To Control Panel - check whether any new java version Updated -Uninstall it and Configure the Build Path JRE Library "Execution environment" to the Previous Version.
转到控制面板 - 检查是否有任何新的 java 版本更新 - 卸载它并将构建路径 JRE 库“执行环境”配置为以前的版本。
Probably if Java 7 is updated to Java 8 the above problem will occur. To avoid that warning, just you can uninstall the new update and restore the old version in execution environment.
可能如果 Java 7 更新到 Java 8 就会出现上述问题。为避免该警告,您只需在执行环境中卸载新更新并恢复旧版本即可。
回答by Nestor Eyros
This should work:
这应该有效:
- Your project > Build Path > Configure Build Path.
- Go to Libraries tab.
- Select JRE System Library [JavaSE-1.7].
- Press Edit.
- Notice that "Execution environment" is JavaSE-1.7 (jdk1.8.{y}).
- Click on Installed JREs.
- You should see jdk1.8.{y} but not jdk1.7.{x}.
- Press Add.
- Select Standard VM.
- Press Next.
- Locate your java folder, e.g.:
C:\Program Files\Java\jdk1.7.{x}
. If you don't have it, you need to install it. - Populate JRE home with it. e.g.
C:\Program Files\Java\jdk1.7.0_80
.
- 您的项目 > 构建路径 > 配置构建路径。
- 转到库选项卡。
- 选择 JRE 系统库 [JavaSE-1.7]。
- 按编辑。
- 请注意,“执行环境”是 JavaSE-1.7 (jdk1.8.{y})。
- 单击已安装的 JRE。
- 您应该看到 jdk1.8.{y} 而不是 jdk1.7.{x}。
- 按添加。
- 选择标准虚拟机。
- 按下一步。
- 找到您的 java 文件夹,例如:
C:\Program Files\Java\jdk1.7.{x}
. 如果你没有它,你需要安装它。 - 用它填充 JRE 主页。例如
C:\Program Files\Java\jdk1.7.0_80
。
"Execution environment" will be JavaSE-1.7 (jdk1.7.0_80) now.
“执行环境”现在将是 JavaSE-1.7 (jdk1.7.0_80)。
回答by Candy
- Open eclipse
- Right click on your project -> click "properties"
- Select "Java Build Path" and then choose Librarires
- Delete JRE System Library [jre1.._***]
- Click "Add Library" and then choose "JRE System Library"
- The best solution is to mark "Workspace default JRE (jre1.,_***)
- Refresh project and wait for Tomcat or any other additional server to restart and then should be no error for "Execution environment.."Where to do it!
- 打开日食
- 右键单击您的项目-> 单击“属性”
- 选择“Java Build Path”,然后选择 Libraires
- 删除 JRE 系统库 [jre1. . _***]
- 单击“添加库”,然后选择“JRE 系统库”
- 最好的办法是标记“Workspace default JRE (jre1. ,_***)
- 刷新项目并等待 Tomcat 或任何其他附加服务器重新启动,然后“执行环境..”应该没有错误了在哪里做!
回答by TonyG
I have this situation because I have multiple JDKs, and the JREs are nested below them. I'm building a JRE8 project but my current default is the latest v11. So the challenge is to get Eclipse to recognize the JDK>JREv8.
我有这种情况是因为我有多个 JDK,并且 JRE 嵌套在它们下面。我正在构建一个 JRE8 项目,但我当前的默认值是最新的 v11。所以挑战是让 Eclipse 识别 JDK>JREv8。
- Go to Preferences > Java > Installed JREs.
- Click Add.
- Navigate to the JRE under the JDK, which in my case is C:\Program Files\Java\jdk1.8.0_152\jre.
- Change the JRE name to JDK8 JRE8 just for clarity.
- Click Finish.
- 转至首选项 > Java > 已安装的 JRE。
- 单击添加。
- 导航到 JDK 下的 JRE,在我的例子中是 C:\Program Files\Java\jdk1.8.0_152\jre。
- 为了清楚起见,将 JRE 名称更改为 JDK8 JRE8。
- 单击完成。
On build the error goes away. :)
在构建时,错误消失了。:)
回答by Ankur Lahiry
Solved by
已解决
Right click on JRE System Library
Select Properties
Choose Workplace Default JRE
Apply and Close