0

I have a problem with running Netbeans for Java development..

When I try to run it I get

missing JDK error

I checked the config located in <netbeans_dir>/etc/netbeans.conf and found following setting:

netbeans_jdkhome="/usr/"

So, I checked java and javac:

>>java -version
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.16.04.2-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
>>whereis java
java: /usr/bin/java /usr/share/java /usr/share/man/man1/java.1.gz
>>javac -version
javac 1.8.0_151
>>whereis javac
javac: /usr/bin/javac /usr/share/man/man1/javac.1.gz

So I updated netbeans_jdkhome to /usr/bin/javac. Now, when I try to run Netbeans I get

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

I also tried to reinstall Java according to this instruction but once I did and changed jdkhome to /usr/lib/jvm/java-8-openjdk I still get Cannot find java.

What should I enter to run Netbeans properly?

Tomasz Kapłoński
  • 1,320
  • 4
  • 24
  • 49

1 Answers1

0

Tools -> Java Platforms -> Add platform should display something like this: enter image description here

Notice that Platform folder has small rectangle that indicates it can be chosen.

zlakad
  • 1,314
  • 1
  • 9
  • 16
  • **export PATH=$PATH:/usr/lib/jvm/java-8-openjdk/bin** *(Note: "/usr/lib/jvm/java-8-openjdk" is symbolically used here just for demostration. You should use your path as per your installation.)* In your comment you used `/usr/lib/jvm/java-8-openjdk`... If this is the path where you installed your java, just add `/usr/lib/jvm/java-8-openjdk/bin` – zlakad Mar 11 '18 at 15:57
  • 1
    Ideally, you `export JAVA_HOME`, and then `export PATH=$JAVA_HOME/bin:$PATH` – OneCricketeer Mar 12 '18 at 06:16