已安装的 JRE/JDK 未显示在 Eclipse Mars 的执行环境中
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31140756/
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
Installed JRE/JDKs are not shown on Eclipse Mars' Execution Environments
提问by Gustavo Ramos
I've just installed Java EE Eclipse Mars, with a JDK 8u45 x64 and JDK 7u79 x64 JDKs. My eclipse.inifile is pointing the -vmoption to my Java 8 JDK Home: C:\ambiente_mars\jdk8u45x64\bin\javaw.exe.
我刚刚安装了带有 JDK 8u45 x64 和 JDK 7u79 x64 JDK 的 Java EE Eclipse Mars。我的eclipse.ini文件将-vm选项指向我的 Java 8 JDK Home: C:\ambiente_mars\jdk8u45x64\bin\javaw.exe.
When I started Eclipse and was configuring my environment I started to set my Installed JREslike this (and like I've done since Indigo):
当我启动 Eclipse 并配置我的环境时,我开始Installed JREs像这样设置我的环境(就像我自 Indigo 以来所做的那样):


My Compiler Settings are configured this way:
我的编译器设置是这样配置的:


After all this, I went to Execution Environmentsto choose the right VM for all the environments, but my configured JRE's are not there:
毕竟,我去Execution Environments为所有环境选择正确的 VM,但我配置的 JRE 不在那里:


Actually, this JRE is not shown for any of the Execution Enviroments <= JSE 1.7. This very same screen, but now on Luna shows everything right, so I think I'm not doing anything wrong.
实际上,对于任何执行环境 <= JSE 1.7,都不会显示此 JRE。这个完全相同的屏幕,但现在在 Luna 上显示一切正常,所以我认为我没有做错任何事情。
Maybe this is a bug? Can someone point another way to do it?
也许这是一个错误?有人可以指出另一种方法吗?
Thanks a lot in advance, lads!
非常感谢小伙子们!
Edit 1:Eclipse is x64 too. Thought it would be good to remember ;)
编辑 1:Eclipse 也是 x64。认为记住会很好;)
回答by Yura Shinkarev
Try this: click "Search.." on item "Installed JREs". Choose your java folder.
试试这个:在“已安装的 JRE”项上单击“搜索..”。选择您的 java 文件夹。
Default is: c:\Program Files\Java\
默认为:c:\Program Files\Java\
回答by James G
I had this problem while looking into issues with an Eclipse (Neon .1) installation yesterday.
昨天我在调查 Eclipse (Neon .1) 安装问题时遇到了这个问题。
After trying plenty of different things, we spotted that the machine had both the environment variable "JRE_HOME" set to a JRE that wasn't the one running eclipse, and a _JAVA_OPTS (global java settings override) environment variable set. When we took both of these out, the execution environments finally started being found!
在尝试了很多不同的事情之后,我们发现机器将环境变量“JRE_HOME”设置为不是运行 eclipse 的 JRE,并设置了 _JAVA_OPTS(全局 Java 设置覆盖)环境变量。当我们把这两个都拿出来时,终于开始找到执行环境了!
Unfortunately, we removed both at once, so I can't say which of the two it was, but it's another thing you could try changing.
不幸的是,我们同时删除了两者,所以我不能说是两者中的哪一个,但您可以尝试更改另一件事。
回答by TinyOS
First , you have correclty added the JDK(JRE) in your Eclipse , but the execusion environement changes from a project to an other and in the same workspace , that means , you have to right click on your project => Build Path => Configure Build Path => Libraries Tab you will find JRE System library [JDK...] => you click on and you click on Edit button then you can select the installed JDK in your machine.
首先,您已经在 Eclipse 中正确添加了 JDK(JRE),但是执行环境从一个项目更改为另一个项目并且在同一工作区中,这意味着您必须右键单击您的项目 => 构建路径 => 配置构建路径 => 库选项卡,您将找到 JRE 系统库 [JDK...] => 单击并单击编辑按钮,然后您可以在您的机器中选择已安装的 JDK。
Also in eclise.inifor eclipse or jbdevstudio.inifor Jboss developper Studio you set the full path of you installed JDK as a default vm
同样在eclise.iniEclipse 或jbdevstudio.iniJboss developer Studio 中,您将安装的 JDK 的完整路径设置为默认虚拟机
This is an example :
这是一个例子:
-vm
C:/Program Files (x86)/Java/jdk1.7.0_51/bin/javaw.exe
About the JAVA_HOME you can modify if by making you default JDK.
关于 JAVA_HOME,您可以通过使您成为默认 JDK 来进行修改。
Hop that is useful for you.
跳这对你有用。

