NetBeans 安装程序未正确定位 Java
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18378169/
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
NetBeans installer Not locating Java properly
提问by Mark Paulino
I'm trying to install the NetBeans "all" package, and, I'm pretty sure I already have Java SE Development Kit installed, however, it's not locating it properly, it comes with an error.
我正在尝试安装 NetBeans“all”包,而且我很确定我已经安装了 Java SE Development Kit,但是,它没有正确定位它,它出现了错误。
Java SE Development Kit (JDK) was not found on this computer
So I ran the CMD and typed:
所以我运行 CMD 并输入:
netbeans-7.1.3-windows.exe --javahome "C:\Program Files\Java\jdk1.7.0_25"
As I checked, I was in the right directory (E:\Mark\Downloads) where the setup file of netbeans is supposed to be. After pressing ENTER, it did locate JDK, however it would not locate JRE and came up with this error.
当我检查时,我在正确的目录 (E:\Mark\Downloads) 中,应该是 netbeans 的安装文件。按ENTER后,它确实找到了JDK,但是它找不到JRE并出现了这个错误。
Java Runtime Environment (JRE) was not found
There is no JRE at the specified location C:\Program Files\Java\jdk1.7.0_25
So I tried installing the JDK+NetBeans Bundle by Oracle [x86 (32-bit) for Windows (I'm running a 32-bit Windows XP SP3 so it should have worked)] but it says that it's not compatible with my current platform. I also tried --jdkhome but it didn't seem to work at all. Please, this has been going on for two days.
所以我尝试安装 JDK+NetBeans Bundle by Oracle [x86 (32-bit) for Windows(我运行的是 32 位 Windows XP SP3,所以它应该可以工作)] 但它说它与我当前的平台不兼容. 我也试过 --jdkhome 但它似乎根本不起作用。拜托,这已经持续了两天了。
回答by sajjadG
You can pass jdk directory with --javahome
in command line.
您可以--javahome
在命令行中传递 jdk 目录。
$./netbeans.sh --javahome ~/path/to/jdk/
another solution is to define JAVA_HOME
enviroment variable like this:
另一种解决方案是JAVA_HOME
像这样定义环境变量:
$export JAVA_HOME=~/path/to/jdk
$export PATH=$JAVA_HOME:$PATH
$./netbeans.sh
and also you can download netbeans+jdk bundle
from oracle site.
你也可以netbeans+jdk bundle
从oracle网站下载。
In your case the error is about JRE. JRE is inside JDK and installer should find it there. what happens if you pass the JRE path with --javahome
? Netbeans can be installed with JRE and then link it with JDK later from inside it.
在您的情况下,错误与 JRE 有关。JRE 在 JDK 中,安装程序应该在那里找到它。如果你通过 JRE 路径会发生什么--javahome
?Netbeans 可以与 JRE 一起安装,然后稍后从内部将其与 JDK 链接。
Then try defining JAVA_HOME
in your system environment variables and append it to your PATH
env too.
然后尝试JAVA_HOME
在您的系统环境变量中定义并将其附加到您的PATH
env 中。
UPDATE:
更新:
You can get netbeans, JDK and netbeans+jdk bundles for 32 and 64bit architecture from following link:
您可以从以下链接获得适用于 32 位和 64 位架构的 netbeans、JDK 和 netbeans+jdk 包:
回答by Terry Li
Just check if JDK is properly installed at C:\Program Files\Java\jdk1.7.0_25.
只需检查 JDK 是否正确安装在 C:\Program Files\Java\jdk1.7.0_25。
In case your JDK installation should be compromised, try uninstalling it and re-installing jdk1.7.0_25 at the same location.
如果您的 JDK 安装受到威胁,请尝试将其卸载并在同一位置重新安装 jdk1.7.0_25。
回答by IAmALinux
I've fought with this problem, and I use a no-hassle solution for Linux.
我已经解决了这个问题,我对 Linux 使用了一个简单的解决方案。
Instead of installing Netbeans from https://netbeans.org/, download it from Oracle packaged with JDK.
不要从https://netbeans.org/安装 Netbeans ,而是从与 JDK 一起打包的 Oracle 下载它。
Here is the current link.It changes all the time though so just google for netbeans jdk
in the future.
这是当前链接。不过,它一直在变化,所以netbeans jdk
将来只需要谷歌搜索即可。
回答by D33P
Dont't try to locate jdk just enter the path for jre(Java runtime environment) which is installed in the same folder if you installed jdk properly.
不要试图定位jdk,只要正确安装jdk,输入jre(Java运行时环境)的路径即可,该路径安装在同一文件夹中。
netbeans-8.2-windows.exe --javahome "C:\Program Files\Java\jre-9.0.1"
回答by Faxn
The exe seems to be a wrapper for a jar installer. you can extract the jar installer and run that.
exe 似乎是 jar 安装程序的包装器。您可以解压缩 jar 安装程序并运行它。
.\netbeans-8.2-javase-windows.exe --extract netbeans
java -jar netbeans\bundle.jar
'netbeans' in the above is the name of the folder you want the bundle.jar extracted to it could be anything.
上面的'netbeans'是你希望bundle.jar解压到的文件夹的名字,可以是任何东西。
I had a similar error message and couldn't get it to work with the --javahome option but running the jar worked fine.
我有一个类似的错误消息,无法让它与 --javahome 选项一起工作,但运行 jar 工作正常。
回答by Ambareesh
Get the NetBeans and the JDK together - bundled version. Shouldn't have any problems in installation then
获得 NetBeans 和 JDK 的捆绑版本。那么安装应该没有任何问题
http://java.sun.com/javase/downloads/widget/jdk_netbeans.jsp
http://java.sun.com/javase/downloads/widget/jdk_netbeans.jsp
回答by Gy?rgy Ihász
For me, the main problem was that I installed incompatible JDK version, and the error said "The specified jdk folder does not contain jdk". As said above, the easiest solution is to install the bundle, or install a compatible version of JDK.
对我来说,主要问题是我安装了不兼容的JDK版本,错误提示“指定的jdk文件夹不包含jdk”。如上所述,最简单的解决方案是安装捆绑包,或安装兼容版本的 JDK。
回答by Amish Joshi
I also was facing this problem,then i found this jre is not installed http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.htmli installed it,and then opened netbeans.exe ,It ran successfully.
我也遇到这个问题,然后我发现没有安装这个jre http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html我安装了它,然后打开netbeans.exe ,运行成功。
回答by Hyman J
In my case, I assumed without thinking about it that JDK 11 should work. Then I read this from the Netbeans installation instructions:
就我而言,我没有考虑就假设 JDK 11 应该可以工作。然后我从 Netbeans 安装说明中读到了这个:
The Java SE Development Kit (JDK) 8 is required to install NetBeans IDE.
安装 NetBeans IDE 需要 Java SE 开发工具包 (JDK) 8。
After downloading JDK 8 and using it to install Netbeans, everything worked fine.
下载 JDK 8 并使用它安装 Netbeans 后,一切正常。
回答by user10925105
The working solution for me was right click on netbeans_installer.exe
and choose "Run as administrator". I hope, it will be useful.
我的工作解决方案是右键单击netbeans_installer.exe
并选择“以管理员身份运行”。我希望,它会很有用。