NetBeans 23 does not start on Kubuntu 24.04

NekoBean, Apache NetBeans Community mascot

For several months, I’ve been using Kubuntu in my job’s laptop, a couple of days ago I wanted to try some projects in NetBeans, but it refused to start 😟.

If you try to run it from the command line you get this but the application does not show:

$ netbeans 
Detected KDE; use explicit setting for font antialiasing (-J-Dawt.useSystemAAFontSettings=lcd_hrgb)
WARNING: package com.apple.eio not in java.desktop
WARNING: package com.sun.java.swing.plaf.windows not in java.desktop
WARNING: package com.apple.laf not in java.desktop
WARNING: A terminally deprecated method in java.lang.System has been called
WARNING: System::setSecurityManager has been called by org.netbeans.TopSecurityManager (file:/snap/netbeans/111/netbeans/platform/lib/boot.jar)
WARNING: Please consider reporting this to the maintainers of org.netbeans.TopSecurityManager
WARNING: System::setSecurityManager will be removed in a future release

After several tests, I found that it runs if you use the OpenJDK version 17 (in Ubuntu the default version is 21).

To get what JDK you have installed run this command:

$ java -version
openjdk version "21.0.4" 2024-07-16
OpenJDK Runtime Environment (build 21.0.4+7-Ubuntu-1ubuntu224.04)
OpenJDK 64-Bit Server VM (build 21.0.4+7-Ubuntu-1ubuntu224.04, mixed mode, sharing)

Install version 17:

$ sudo install openjdk-17-jdk

and then run NetBeans with it. You can configure JDK 17 for the whole system using the following command

$ sudo update-java-alternatives --set java-1.17.0-openjdk-amd64

Confirm

$ java -version
openjdk version "17.0.12" 2024-07-16
OpenJDK Runtime Environment (build 17.0.12+7-Ubuntu-1ubuntu224.04)
OpenJDK 64-Bit Server VM (build 17.0.12+7-Ubuntu-1ubuntu224.04, mixed mode, sharing)

But you may not want to use OpenJDK version 17 globally, so you can indicate OpenJDK just when running NetBeans:

$ netbeans --jdkhome /usr/lib/jvm/java-17-openjdk-amd64/

And now it shows up 🙌!

To to the same for the applications launcher, look for NetBeans in the Development submenu, right click on it and select Edit Application…

in the window that shows select the Application tab, edit option Arguments, from:

%F

to:

--jdkhome /usr/lib/jvm/java-17-openjdk-amd64/ %F

Done.

1 Comment

Leave a Reply

Your email address will not be published.


*