Java 如何将执行环境 1.8 添加到 Eclipse Luna?

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

How do I add execution environment 1.8 to Eclipse Luna?

javaeclipseide

提问by geoxile

I have jre8 installed and set as the default for the jre but under compiler compliance I can't find 1.8 and under execution environment I can't find javaSE 1.8. I'm using the latest build of Eclipse EE.

我安装了 jre8 并将其设置为 jre 的默认值,但在编译器合规性下我找不到 1.8,在执行环境下我找不到 javaSE 1.8。我正在使用最新版本的 Eclipse EE。

I took a look at this manual http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftask-add_new_jre.htmBut I couldn't find any .ee files in my jre8 or JDK1.8 installation directories.

我看了这个手册 http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftask-add_new_jre.htm但我找不到任何我的 jre8 或 JDK1.8 安装目录中的 .ee 文件。

采纳答案by greg-449

Open Preferences and look in 'Java > Installed JREs'. If you don't have a Java 8 shown there click 'Add...' to add it. Close the preferences.

打开首选项并查看“Java > 已安装的 JRE”。如果您没有显示 Java 8,请单击“添加...”以添加它。关闭首选项。

Open Preferences again and look in 'Java > Installed JREs > Execution Environments', select 'JavaSE-1.8' and make sure your Java 1.8 is checked as the Compatible JRE

再次打开 Preferences 并查看“Java > Installed JREs > Execution Environments”,选择“JavaSE-1.8”并确保您的 Java 1.8 被检查为 Compatible JRE

回答by greg-449

Older versions of Eclipse might not work with javaSE-1.8

旧版本的 Eclipse 可能不适用于 javaSE-1.8

You need to find out what version of Eclipse you have by going into its help menu and clicking on About Eclipse.

您需要通过进入帮助菜单并单击关于 Eclipse 来了解您拥有的 Eclipse 版本。

If your version is older than the one at https://www.eclipse.org/downloads/then you need to uninstall your older version and install the latest version.

如果你的版本比一个较老的https://www.eclipse.org/downloads/那么你需要卸载旧版本并安装最新版本。

I had the same problem with my Eclipse on Linux Mint. And the only way I could solve it was by following above instructions.

我的 Eclipse 在 Linux Mint 上遇到了同样的问题。我可以解决它的唯一方法是按照上述说明进行操作。

回答by E_X

If the eclipse version is old as @mike stated in his answer then you would be unable to view the JavaSE-1.8 on the Execution Environments list in your eclipse; You can do the following to use it even on older versions:

如果 eclipse 版本如@mike 在他的回答中所述的那样旧,那么您将无法在 eclipse 的 Execution Environments 列表中查看 JavaSE-1.8;即使在旧版本上,您也可以执行以下操作来使用它:

Or just download and use the latest eclipse

或者直接下载并使用最新的eclipse