32

I know this question has already been posted, but the solutions provided don't work for me. I added the webupd8team/java repository and installed oracle-java8-installer and oracle-java8-set-default. I downloaded netbeans 8.1 from netbeans.org (full version), installed it but when it comes to enabling the java modules it fails, showing me a list of all the modules netbeans can't enable.

I also ran sudo update-alternatives --config java, which outputs

  0            /usr/lib/jvm/java-8-oracle/jre/bin/java   1         auto mode
* 1            /usr/lib/jvm/java-8-oracle/jre/bin/java   1         manual mode

JDK seems to be missing.

I get the correct output when I run both java -version and javac -version

I also tried to run the command netbeans --jdkhome /usr/lib/jvm/java-8-oracle, unsuccessfully. I get an error message saying netbeans is not installed.

Now, all this only happens with the version I download from the website. When I install netbeans from the shell (sudo apt-get install netbeans) everything works just fine.

The thing is I need the full version from the website, because I'm working with HTML5, CSS, J2EE and GlassFish server support.

All help is appreciated.

57

Go to /etc and open netbeans.conf.

Note: you can find netbeans_root_folder with ls -l $(which netbeans)

Make sure the variable netbeans_jdkhome has the correct value, something like:

netbeans_jdkhome="/usr/lib/jvm/java-8-oracle"
| improve this answer | |
  • +1 Or /usr/local/java/java-8-oracle – Zon Jul 27 '17 at 19:03
  • 2
    and for openJdk => netbeans_jdkhome="/usr/lib/jvm/java-8-openjdk-amd64/" – ArMo 372 Apr 9 '18 at 18:44
  • Where's the "netbeans root folder/etc"? – fedd Jun 23 '18 at 17:52
  • 1
    @fedd for root folder ls -l $(which netbeans) will give you this answer something like /usr/local/netbeans-8.2/ can be... – Philippe Gachoud Jul 5 '18 at 20:20
4

Either edit /usr/local/netbeans-X.Y/etc/netbeans.conf to contain

netbeans_jdkhome="/usr/lib/jvm/java"

Or use the command:

/usr/local/netbeans-X.Y/bin/netbeans --jdkhome /usr/lib/jvm/java
| improve this answer | |
2

edit /usr/local/netbeans-X.Y/etc/netbeans.conf file

netbeans_jdkhome="/usr/lib/jvm/java-8-openjdk-amd64"
| improve this answer | |
  • I don't understand what is this supposed to mean. What are you reader supposed to do with the fragment netbeans_jdkhome="/usr/lib/jvm/java-8-openjdk-amd64"? Could you please edit your post to explain? Thanks. – David Foerster Feb 23 '18 at 0:36
1

It means the netbeans.conf file (located in two places) was not set up correctly.To solve this you might do:

First: open TERMINAL go to /etc

cd /etc

Second: open netbeans.conf file as superuser (sudo):

sudo gedit netbeans.conf

Third: Edit the line wich corresponds to your JVM (Java Virtual Machine) folder. It looks like #netbeans_jdkhome="/usr/lib/jvm/java-8-openjdk-amd64/".

Change the local according to your JVM version.

To find out what JVM version you use, go to the JVM folder by typing in terminal:

cd /usr/lib/jvm

and see what name is folder that contains JVM. For example, mine is named java-8-opendjdk-amd64

Fourth: let's edit the second netbeans.conf file located at your Netbeans installation folder. Open a TERMINAL and type (here I'll use Netbeans 8.2 version):

cd /netbeans-8.2/etc

And open netbeans.conf file in editor as a superuse (sudo):

sudo gedit netbeans.conf

Last step: Edit the line wich corresponds to your JVM (Java Virtual Machine) folder. It looks like #netbeans_jdkhome="/usr/lib/jvm/java-8-openjdk-amd64/".

Don't forget to uncomment the line by removing the # character.

Now save the file, close Netbeans and run it again! IT WORKS !

| improve this answer | |
  • Never ever use sudo for gui programms this way. sudo -H gedit better. – nobody Jan 17 at 9:42
-1

Uninstall and install with selected JVM

https://i.stack.imgur.com/3j8XG.png

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.