加载 Apache Netbeans 9.0 或 10 时出现 Java not found 错误

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

Java not found error when loading Apache Netbeans 9.0 or 10

javanetbeans

提问by Learnerer

I downloaded the archive for the program, unzipped it to C drive on Windows, then when I try to run either executable (32bit/64bit) in the binfolder I get the error message:

我下载了该程序的存档,将其解压缩到 Windows 上的 C 驱动器,然后当我尝试在bin文件夹中运行任一可执行文件(32 位/64 位)时,我收到错误消息:

Cannot find JAVA 1.8 or higher.

找不到 JAVA 1.8 或更高版本

in spite of Java 10 (JRE) being already installed. I also tried Installing Java 9 but was stuck with the same message.

尽管已经安装了 Java 10 (JRE)。我也尝试过安装 Java 9,但被同样的消息困住了。

I appreciate your help with this, Thanks.

感谢您对此的帮助,谢谢。

采纳答案by Just a student

Locate your Netbeans installation and in it the etc/netbeans.conffile. Open it with any text editor, and locate the line containing netbeans_jdkhome. If it is commented out (line starts with #), then remove the #to enable the setting. Then, set the value to the path to your JDK. This might be somethiing like C:\Program Files\Java\jdk-10.0.1.

找到您的 Netbeans 安装并在其中找到该etc/netbeans.conf文件。使用任何文本编辑器打开它,并找到包含netbeans_jdkhome. 如果已注释掉(行以 开头#),则删除#以启用设置。然后,将该值设置为 JDK 的路径。这可能类似于C:\Program Files\Java\jdk-10.0.1.

Try to run the program again, it should work now. At least, it did for me.

尝试再次运行该程序,它现在应该可以工作了。至少,它对我有用。



Also, ensure that you installed the Java Development Kit (JDK), not only the Java Runtime Environment (JRE). Netbeans needs the former to be installed in order to function.

此外,请确保您安装了Java 开发工具包 (JDK),而不仅仅是 Java 运行时环境 (JRE)。Netbeans 需要安装前者才能运行。