2017-05-02

Setting the Java version for NetBeans

Just a friendly reminder, primarily to myself- ;-) You can override the Java version to be used for running NetBeans in the file etc/netbeans.conf.

As you know I gave two talks during our company conference MATHEMA Campus. One was about jshell which naturally ;-) required me to install Java 9 early access. Today, back in the office, I wanted to do some programming. I launched NetBeans on my Mac - and after a couple of seconds it terminated. It was clear that this had to have to do with the early access install. However, I did not want to remove it. So - what to do?

/usr/libexec/java_home, as you may know, lists installed Java versions. It (expectedly) pointed to /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home.

I hat already set JAVA_HOME to the Java 8 installation, but this certainly has no effect on app bundles. This is where etc/netbeans.conf comes in handy. It's inside the NetBeans installation directory, for example /Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans.

Just remove the hash symbol at the beginning of the line #netbeans_jdkhome= and enter the path to a jdk installation. On my machine this currently is /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home.


No comments:

Post a Comment