Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 
like image 633
Claudio Vasconcelos Avatar asked Nov 16 '15 20:11

Claudio Vasconcelos


People also ask

Can NetBeans run without JDK?

To use NetBeans for Java programming, you need to first install Java Development Kit (JDK).

How can I download JDK in NetBeans?

In the IDE, choose Tools > Java Platforms from the main menu. Click Add Platform in the Java Platform Manager dialog. In the Add Java Platform dialog, select Java Standard Edition and click Next. Specify the directory that contains the JDK and click Next.

Which version of JDK is required for NetBeans 12?

Apache NetBeans 12.0 runs on the JDK LTS releases 8 and 11, as well as on JDK 14, i.e., the current JDK release at the time of this NetBeans release.

Which JDK is compatible with NetBeans 14?

The Apache NetBeans 14 binary releases require JDK 11+, and officially support running on JDK 11 and JDK 17.


2 Answers

[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). 
like image 30
rmcghee Avatar answered Oct 11 '22 19:10

rmcghee


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

like image 63
typhon Avatar answered Oct 11 '22 19:10

typhon