8

This is a question which will help you through what to once you have realised that after updating your Java version, NetBeans IDE refuses to launch. And even after updating your $PATH variable in your .bashrc file, you still find that NetBeans will not launch, and when you try and launch it through command-line with the command:

./netbeans-8.0.2/bin/netbeans

Is just gives you:

Cannot find java. Please use the --jdkhome switch.

But then when you try to specify the new jdkhome with (<version will be replaced with your version number, for example it could be replaced with 1.8.0_40):

./netbeans-8.0.2/bin/netbeans --jdkhome jdk<version>/

You find that you have to do that each time for NetBeans to actually launch, and it is becoming rather a nuisance.

So what you actually need to do is to go to the NetBeans config file where the actual JDK home variable is set for NetBeans so that NetBeans can refer to that when starting up.

11

To find the variable which sets the JDK home for Netbeans you need to open the config file which sets it (replace <versionNumber> with the version number of your NetBeans, such as 8.0.2 and make sure that you are in the directory which the NetBeans folder is in, this will most likely either be your home directory (to cd to that do: cd ~), or /usr/local/ (to cd to that do: cd /usr/local/)):

gedit netbeans-<versionNumber>/etc/netbeans.conf

And then locate variable called netbeans_jdkhome and set it to the current location of your JDK folder. For example it could look something like this (<username> replaced with your username):

netbeans_jdkhome="/home/<username>/jdk1.8.0_40"

Then save your changes to the config file, and NetBeans should launch with no problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy