Java 缺少 JDK,需要运行某些 NetBeans 模块
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33744455/
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
The JDK is missing and is required to run some NetBeans modules
提问by Claudio Vasconcelos
Complete error message: The JDK is missing and is required to run some NetBeans modules Please use the --jdkhome command line option to specify a JDK installation or see http://wiki.netbeans.org/FaqRunningOnJrefor more information.
完整的错误消息:JDK 丢失,需要运行某些 NetBeans 模块 请使用 --jdkhome 命令行选项指定 JDK 安装或查看http://wiki.netbeans.org/FaqRunningOnJre以获取更多信息。
Some details: I just installed Netbeans on Linux mint for the first time and when I start it when its turning on modules this error message appears. But I do have jdk installed.
一些细节:我第一次在 Linux mint 上安装了 Netbeans,当我在打开模块时启动它时会出现此错误消息。但是我确实安装了jdk。
$ java -version
$ java -version
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)
$ javac -version
$ javac -version
javac 1.8.0_66
回答by typhon
Find the file [netbeans installation directory]/etc/netbeans.conf
找到文件 [netbeans installation directory]/etc/netbeans.conf
Luckily, Linux has a find
helper like
find /home/ -name "netbeans.conf
,
in which you can change the /home/
to a location where you want to search.
幸运的是,Linux 有一个find
类似的帮助程序
find /home/ -name "netbeans.conf
,您可以在其中将 更改为/home/
您想要搜索的位置。
I found it at /usr/local/netbeans-8.1/etc/netbeans.conf
我在 /usr/local/netbeans-8.1/etc/netbeans.conf
Once, you found the file, the following property needs to be set:
找到该文件后,需要设置以下属性:
netbeans_jdkhome="[jdk_path]"
where you can find the jdk_pathusing:
您可以使用以下方法找到jdk_path:
update-alternatives --config java
In my case, I found it at /opt/java/jdk1.8.0_191
就我而言,我在 /opt/java/jdk1.8.0_191
回答by lfjaramillos
This worked for me
这对我有用
1. install full JDK
2. either edit <netbeans-IDE-installation>/etc/netbeans.conf
2.1 unmark netbeans_jdkhome
2.2 link to JDK location e.g. /usr/local/share/java/jdk1.6.0_07/
3. or use --jdkhome command-line option e.g. ./bin/netbeans --jdkhome /usr/local/share/java/jdk1.6.0_07/
take care with the "/" at the end
注意末尾的“/”
More info in http://wiki.netbeans.org/FaqRunningOnJre
回答by rmcghee
[Solved] For Mac OSX 10.11 (El Capitan). Solution may be similar for other Unix-based systems.
[已解决] 对于 Mac OSX 10.11 (El Capitan)。对于其他基于 Unix 的系统,解决方案可能类似。
The problem may have occurred because I inadvertently installed the jre prior to installing the jdk. I uninstalled the jre, installed the jdk and reinstalled NetBeans but the problem (popup window) remained. However, the fix was fairly simple.
问题可能是因为我在安装jdk之前不小心安装了jre。我卸载了 jre,安装了 jdk 并重新安装了 NetBeans,但问题(弹出窗口)仍然存在。然而,修复相当简单。
1. Make sure NetBeans is not running. 2. Make sure the jdk is installed. 3. Determine the location of the jdk: The jdk location can be determined by entering the following (in Terminal): $ /usr/libexec/java_home For my system, the output was: /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home 4. Edit the NetBeans configuration file to indicate the location of the jdk. Near the bottom of this Netbeans configuration file (or equivalent for your NetBeans version): /Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/etc/netbeans.conf Comment out the following line (insert a # before the first character): #netbeans_jdkhome="/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/bin/jre" Then, add the following line (or equivalent for your jdk version): netbeans_jkdhome="/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home" Then, save and exit the editor. 5. Start NetBeans (no more popup window indicating that the jdk is missing).
回答by Norman Pilusa
Ubuntu 16.04 LTS:
Ubuntu 16.04 LTS:
- Uninstall the netbeans you have.
- Delete
.cache/netbeans
folder - Download http://www.oracle.com/technetwork/java/javase/downloads/jdk-netbeans-jsp-142931.html
- Install your download
- 卸载您拥有的 netbeans。
- 删除
.cache/netbeans
文件夹 - 下载http://www.oracle.com/technetwork/java/javase/downloads/jdk-netbeans-jsp-142931.html
- 安装您的下载
回答by Ramin Axundbeyli
I have this problem to. But now i resolove this problem with edit one line.
我有这个问题。但是现在我通过编辑一行来解决这个问题。
- Find and open this file /etc/netbeans.conf
- If you see netbeans_jdkhome="C:\Program Files\Java\jre1.8.0_151"replace netbeans_jdkhome="C:\Program Files\Java\jdk1.8.0_131"
- Save as adminstrator
- 找到并打开这个文件/etc/netbeans.conf
- 如果你看到netbeans_jdkhome="C:\Program Files\Java\jre1.8.0_151"替换netbeans_jdkhome="C:\Program Files\Java\jdk1.8.0_131"
- 另存为管理员
Problem reseloved
问题已解决
回答by smiley
- Open netbeans.conf
- 打开 netbeans.conf
sudo nano "/usr/lib/jvm/java-8-oracle/netbeans.conf
"
sudo nano "/usr/lib/jvm/java-8-oracle/netbeans.conf
”
- Set proper sdk path:
- 设置适当的 sdk 路径:
netbeans_jdkhome="/usr/lib/jvm/java-8-oracle"
netbeans_jdkhome="/usr/lib/jvm/java-8-oracle"
- Exit Ctrl+ Xand to save changes Ctrl+ T
- 退出Ctrl+X并保存更改Ctrl+T
回答by Edward Bustamante
When netbeans has problems trying to find the path of the jdk, it's mainly because the version of the jdk does not match. Open the file C:\Program Files\NetBeans 8.2\etc\netbeans.conf, and verify that netbeans_jdkhome = "C:\Program Files\Java\jdk1.8.0_111".
当netbeans在尝试查找jdk的路径时出现问题,主要是因为jdk的版本不匹配。打开文件 C:\Program Files\NetBeans 8.2\etc\netbeans.conf,并验证 netbeans_jdkhome = "C:\Program Files\Java\jdk1.8.0_111"。
回答by Jan
In mid April 2019, Oracle has changed the JDK's licence. However, I was still able to solve this issue with NetBeans 11 and the JDK 12's open source build on my Windows machine. Just downloaded the open source JDK from https://jdk.java.net/and extracted it. Then, in my NetBeans config file, I typed in the path to the extracted directory (NOT the "bin" folder!).
2019 年 4 月中旬,Oracle 更改了 JDK 的许可证。但是,我仍然能够在我的 Windows 机器上使用 NetBeans 11 和 JDK 12 的开源版本解决这个问题。刚刚从https://jdk.java.net/下载了开源JDK并解压。然后,在我的 NetBeans 配置文件中,我输入了解压目录的路径(不是“bin”文件夹!)。