Ubuntu 18.04.6 LTS
Netbeans updated (to version 19) over the weekend, and it is now completely broken. Whenever I try to start Netbeans, a pop-up shows up:
Pop-up Title: Java 11 or newer required Pop-up Desc: Cannot run on older versions of Java than Java 11. Please install Java 11 or newer or use --jdkhome switch to point to its installation directory.
The pop-up can be dismissed but Netbeans will not open.
I do not want to use Java 11 (currently using Java 8) because some of my dependencies do not support it. What is the best way to fix this? Can I roll back this unwanted update? How do I prevent Netbeans from being updated in the future?
UPDATES: It seems rolling back Netbeans is not an option. As a workaround, I installed Java 11, which has not yet fixed the problem.
Installed Java 11 using: sudo apt-get install openjdk-11-jdk Netbeans still fails. Pop-up says requires Java 11.
Set default java to openjdk11 using:
sudo update-alternatives --config java Netbeans still fails. Pop-up says requires Java 11.
I checked the jdkhome line in netbeans.conf, and found 3 instances of this file:
/etc/netbeans.conf
/snap/netbeans/84/netbeans/etc/netbeans.conf
/snap/netbeans/80/netbeans/etc/netbeans.conf
All three files have the jdkhome line commented out using a #. I can only edit the /etc/netbeans.conf file, the other 2 are uneditable (even using sudo nano [file]).
Set jdkhome in /etc/netbeans.conf file using:
sudo nano /etc/netbeans.conf
Tried: netbeans_jdkhome="/usr/lib/jvm" Netbeans fails to launch.
netbeans_jdkhome="/usr/lib/jvm/java-11-openjdk-amd64" Netbeans fails to launch.
netbeans_jdkhome="/usr/lib/jvm/java-11-openjdk-amd64/bin" Netbeans fails to launch.
/snap/netbeans/current/netbeans/bin/netbeans --jdkhome /usr/lib/jvm/java-11-openjdk-amd64 Throws a warning : "Warning - An instance of the program cannot access specified user directory. This is a serious problem that may prevent the program to function properly. Make sure is writable. Click OK to continue in spite of previous error."
Clicking OK gives an error:
java.io.FileNotFoundException: /snap/netbeans/84/netbeans/bin/lock (Read-only file system)
Running the prior command with sudo gives the exact same result. Java 11 and Java 8 are both installed in the same place (/usr/lib/jvm), so it is beyond me why it could access Java 8 JDK just fine a week ago, and now "cannot access specified user directory".
UPDATE 2: I went back to running netbeans from terminal using the --jdkhome switch and finally found the magic words...sort of:
XYZ@XYZ:/snap/netbeans/current/netbeans/bin$ netbeans --jdkhome /usr/lib/jvm/java-11-openjdk-amd64 WARNING: package com.apple.eio not in java.desktop
The ^above^ command successfully starts Netbeans, but it doesn't FIX Netbeans, because opening Netbeans from the desktop icon still fails with the original error. I have to start it from Terminal with the above command.
I tried changing Tools>Options>Java options to use Java 11 or 17 with no effect (even though I still plan to use Java 8 for dev).
open netbeans.conf file in notepad, e.g. mine is situated in C:\ides\netbeans\etc\netbeans.conf
and set netbeans_jdkhome variable on your own , e.g. netbeans_jdkhome="C:\Program Files\Java\jdk-22"
save the file , launch the IDE and you are done.
I'm using Windows and I had the same issue just now. I uninstalled Netbeans-19, then manually installed JDK-20:
https://www.oracle.com/java/technologies/downloads/#jdk20-windows
I then reinstalled Netbeans-19 pointing the installer to the JDK-20 folder and it worked fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With