Eclipse 未找到 JRE

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

JRE not found by eclipse

javaeclipse

提问by Inertialilty

I am having issues starting up my java neon, and it keeps saying saying "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/jre1.8.0_45/bin" but i installed the jre1.8.0_131, as i dont know how to either downgrade mine or update eclipse's. I feel so silly for not even knowing how to do this but thanks for any help you guys have!

我在启动我的 java neon 时遇到问题,它一直说“必须有一个 Java 运行时环境 (JRE) 或 Java 开发工具包 (JDK) 才能运行 eclipse。搜索以下位置后没有找到 java 虚拟机C:/Program Files/Java/jre1.8.0_45/bin”,但我安装了 jre1.8.0_131,因为我不知道如何降级我的或更新 eclipse 的。我什至不知道如何做到这一点,我感到很傻,但感谢你们提供的任何帮助!

回答by Michael Dz

It's better if you uninstall current java version and install newest jdk from here. This jdk also contains jre inside.

如果您卸载当前的 java 版本并从此处安装最新的 jdk,则效果会更好。这个jdk里面也包含jre。

After installation in Eclipse go to Preferences -> Java -> Installed JREsand point to your jdk installation folder, for example C:\Java\jdk1.8.0_131. After that it should be fine.

在 Eclipse 中安装后,转到Preferences -> Java -> Installed JREs并指向您的 jdk 安装文件夹,例如C:\Java\jdk1.8.0_131. 之后应该就没问题了。

回答by Christoph-Tobias Schenke

Please edit the eclipse.ini which is located in the eclipse folder and specifiy the vm you want to use.

请编辑位于 eclipse 文件夹中的 eclipse.ini 并指定要使用的虚拟机。

simply add two lines at the beginning of the file (set path to directory of your java installation)

只需在文件开头添加两行(将路径设置为 java 安装目录)

-vm
C:/Program Files/Java/jdk1.8.0_121/bin/javaw.exe

the other way is to check and update the environment variables JAVA_HOME and/or JRE_HOME.

另一种方法是检查和更新环境变量 JAVA_HOME 和/或 JRE_HOME。

回答by RostSunshine

This is not a version problem, but a problem with where it is installed. You need to do more than install the JDE or JDK. You have to put it in a special location depending on your OS.

这不是版本问题,而是安装位置的问题。您需要做的不仅仅是安装 JDE 或 JDK。您必须根据您的操作系统将它放在一个特殊的位置。

Here is a good step by step for installing JDK on MAC, Windows and Linux: https://www3.ntu.edu.sg/home/ehchua/programming/howto/JDK_Howto.html

这是在 MAC、Windows 和 Linux 上安装 JDK 的一个很好的步骤:https: //www3.ntu.edu.sg/home/ehchua/programming/howto/JDK_Howto.html

You might also need to look at what you gave eclipse access to in the setup stage. There is a chance you didn't give it the option to look in the place it needs to.

您可能还需要查看在设置阶段授予 eclipse 访问权限的内容。有可能你没有给它在它需要的地方寻找的选项。

I would reccommend you try to compile and run java from a text file and use the command prompt before an IDE. If you can compile and run a test prompt then you know its in the right spot and the problem lies with eclipse location/locator.

我建议您尝试从文本文件编译和运行 java,并在 IDE 之前使用命令提示符。如果您可以编译并运行测试提示,那么您就知道它在正确的位置,问题出在 eclipse 位置/定位器上。

To run from a text file. Just open a text file, save it as something.java then type some code and navigate to the file, type javac name of file.java and then if that works type java name of fileIf this all works fine then it is a problem with eclipse. If not you have a problem with where it is installed.

从文本文件运行。只需打开一个文本文件,将其另存为 something.java 然后键入一些代码并导航到该文件,键入文件.java 的javac名称,然后如果可行,则键入文件的java名称如果这一切正常,那么这是一个问题蚀。如果不是,则您的安装位置有问题。

回答by Thihara

Your JAVA_HOME and or JRE_HOME variables are probably pointing to a wrong installation.

您的 JAVA_HOME 和/或 JRE_HOME 变量可能指向错误的安装。

Update those environmental variables and you should be good.

更新这些环境变量,你应该很好。