I've installed the NetBeans snap on Ubuntu 23.10. I've also installed the OpenJDK v22 snap.
When I try to run netbeans in my shell, I get the error:
Cannot find java. Please use the --jdkhome switch.
How can I make NetBeans aware of the openJDK snap?
The OpenJDK snap seems to be installed in the location below because when I type openjdk in my shell, I see the following:
/var/snap/openjdk/1735/openjdk.env
I already tried adding source /var/snap/openjdk/1735/openjdk.env to my .bashrc file to ensure that when I run java -version it knows that I'm using OpenJDK. This doesn't work for NetBeans though.
Related snap packages:
I was able to get netbeans running by executing the following commands in the shell.
JAVA_HOMEenvironment variable:2.Add
Java_HOMEto the executablePATHI will add the two commands above to my
~/.bashrcfile so that those two commands are executed when starting the shell.NOTE - This only works for the shell not the Ubuntu UI.
Related documentation:
https://github.com/jgneff/openjdk
https://snapcraft.io/openjdk