The JDK is missing and is required to run some NetBeans modules

85,577

Solution 1

Find the file [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.

I found it at /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_path using:

update-alternatives --config java

In my case, I found it at /opt/java/jdk1.8.0_191

Solution 2

[Solved] For Mac OSX 10.11 (El Capitan). Solution may be similar for other Unix-based systems.

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.

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).

Solution 3

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".

Solution 4

  1. Open netbeans.conf

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

  1. Set proper sdk path:

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

  1. Exit Ctrl + X and to save changes Ctrl + T
Share:
85,577

Related videos on Youtube

Claudio Vasconcelos
Author by

Claudio Vasconcelos

Updated on July 09, 2022

Comments

  • Claudio Vasconcelos
    Claudio Vasconcelos 11 months

    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/FaqRunningOnJre for more information.

    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.

    $ 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 1.8.0_66
    
    • Nitek
      Nitek over 7 years
      You have the JRE installed, but you (also) need the JDK
    • RealSkeptic
      RealSkeptic over 7 years
      To quickly check if you have a JDK, try javac -version - the Java compiler is part of the JDK, not part of the JRE.
    • WillShackleford
      WillShackleford over 7 years
      check the file etc/netbeans.conf under where you installed netbeans and find the line that starts with netbeans_jdkhome= Is that pointing to the correct JDK directory?
  • VeKe
    VeKe about 7 years
    netbeans_jdkhome = should be path of JDK?
  • Quaternion
    Quaternion almost 7 years
    On my system using open-jdk the path is: /usr/lib/jvm/java-8-openjdk-amd64
  • Chro
    Chro almost 7 years
    On Windows it's in the Netbeans installation directory e.g. C:\Program Files\NetBeans 8.1\etc
  • Paul Uszak
    Paul Uszak over 6 years
    Yes this works. You can also enter this as [netbeans_jdkhome="/usr/lib/jvm/default-java"] where [default-java] is a symbolic link to the actual JDK directory. This is what I did for Ubuntu 16.04.
  • briankip
    briankip over 6 years
    This works, on Ubuntu with netbeans 8.2 the path is ~/netbeans for netbeans.conf and /usr/lib/jvm/java-8-openjdk-amd64/ for JDK
  • pzaj
    pzaj almost 6 years
    @Quaternion sorry to bother you, I did try with openJDK, but it does not work for some reason. Netbeans 8.2 + latest OpenJDK available from Ubuntu 16.04 apt. Any idea what may be wrong?
  • Quaternion
    Quaternion almost 6 years
    Did the NB install succeed? If should require the JDK to be set during the install and then it would be rare for things to not work, if the install did not succeed what error are you getting? What is the result of running the command: "update-java-alternatives -l" in the shell? It should list all installed java versions... Review this site: digitalocean.com/community/tutorials/… also stability is good for deployment but for development cutting edge I find to be the best (Ubuntu 17.04).
  • ArmaGeddON
    ArmaGeddON almost 6 years
    On Kali Linux 2017.1, netbeans.conf was in (/usr/local/netbeans-8.2/etc) and JDK in (/usr/lib/jvm/java-8-openjdk-amd64)
  • Alejandro Fort
    Alejandro Fort over 2 years
    It worked using netbeans 8.2 RC, JDK 1.8, and macOS BigSur 11.0.1 Thanks a lot!!

Related