簡體   English   中英

"缺少 JDK,需要運行某些 NetBeans 模塊"

[英]The JDK is missing and is required to run some NetBeans modules

完整的錯誤消息:缺少JDK ,需要運行某些 NetBeans 模塊

一些細節:我第一次在 Linux mint 上安裝了 Netbeans,當我在它打開模塊時啟動它時,會出現此錯誤消息。 但是我確實安裝了jdk。

$ java -版本

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-版本

javac 1.8.0_66

找到文件[netbeans installation directory]/etc/netbeans.conf

幸運的是,Linux 有一個find助手,如find /home/ -name "netbeans.conf ,您可以在其中將/home/更改為您想要搜索的位置。

我在/usr/local/netbeans-8.1/etc/netbeans.conf找到它

找到該文件后,需要設置以下屬性:

netbeans_jdkhome="[jdk_path]"

您可以使用以下方法找到jdk_path

update-alternatives --config java

就我而言,我在/opt/java/jdk1.8.0_191找到它

[已解決] 對於 Mac OSX 10.11 (El Capitan)。 對於其他基於 Unix 的系統,解決方案可能類似。

問題可能是因為我在安裝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).
  1. 打開 netbeans.conf

sudo nano "/usr/lib/jvm/java-8-oracle/netbeans.conf

  1. 設置適當的 sdk 路徑:

netbeans_jdkhome="/usr/lib/jvm/java-8-oracle"

  1. 退出Ctrl + X並保存更改Ctrl + T

當netbeans在嘗試查找jdk的路徑時出現問題,主要是因為jdk的版本不匹配。 打開文件 C:\\Program Files\\NetBeans 8.2\\etc\\netbeans.conf,並驗證 netbeans_jdkhome = "C:\\Program Files\\Java\\jdk1.8.0_111"。

這對我有用

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/ 

注意末尾的“/”

更多信息在http://wiki.netbeans.org/FaqRunningOnJre

Ubuntu 16.04 LTS:

  1. 卸載您擁有的 netbeans。
  2. 刪除.cache/netbeans文件夾
  3. 下載http://www.oracle.com/technetwork/java/javase/downloads/jdk-netbeans-jsp-142931.html
  4. 安裝您的下載

我有這個問題。 但是現在我通過編輯一行來解決這個問題。

  1. 找到並打開這個文件/etc/netbeans.conf
  2. 如果你看到netbeans_jdkhome="C:\\Program Files\\Java\\jre1.8.0_151"替換netbeans_jdkhome="C:\\Program Files\\Java\\jdk1.8.0_131"
  3. 另存為管理員

問題已解決

2019 年 4 月中旬,Oracle 更改了 JDK 的許可證。 但是,我仍然能夠在我的 Windows 機器上使用 NetBeans 11 和 JDK 12 的開源版本解決這個問題。 剛剛從https://jdk.java.net/下載了開源JDK並解壓。 然后,在我的 NetBeans 配置文件中,我輸入了解壓目錄的路徑(不是“bin”文件夾!)。

我通過使用以下命令將我正在使用的 JRE 和 JDK 的默認版本更改為 11.xx 解決了這個問題:

sudo update-alternatives --config java
sudo update-alternatives --config javac

當我將 Mac 更新到 Mojave 時出現了這個錯誤。 為了解決這個問題,我使用終端編輯了帶有當前 jdk 的 netbeans.conf 文件,以找到正確的 jdk。 輸入 /usr/libexec/java_home -V

這是我的輸出。

Matching Java Virtual Machines (4):
    1.8.311.11 (x86_64) "Oracle Corporation" - "Java" /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
    1.8.0_131 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
    1.8.0_25 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home
    1.7.0_79 (x86_64) "Oracle Corporation" - "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home

輸入列出的第一個 jdk 不起作用。 我用列出的第二個編輯了 conf 文件: netbeans_jdkhome="/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home"

重新啟動 Netbeans。 那解決了它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM