HighDPI Netbeans with Java 9

I needed to modify an old Java program of mine, so I opened up NetBeans again for the first time in over a year. I was reminded yet again why I grew out of Java: High DPI support for Swing. I was getting sick of squinting: Megaaaa! so I did some research. The NetBeans website said to download the latest dev build. At the bottom of this page says:

Running NetBeans on JDK9 EA as run time Java platform It is possible to try this NetBeans build to run on JDK9 EA build as NetBeans IDE runtime platform. Use it with care as JDK9 EA is still under development as well as NetBeans JDK9 branch. We adopt NetBeans JDK9 to JDK9 EA changes but in some cases it takes some time. Necessary command line options are in nb_install_dir/etc/netbeans.conf file. If you discover you need to -add-export another JDK module then add it in this file and file a bug for NB JDK9.

So I checked, and all you really need to do (once you have installed JDK 9 and the latest dev build is go into the {NetBeans install folder}/etc/netbeans.conf and modify _netbeansjdkhome to point to the path of the v9 JDK (e.g. _netbeansjdkhome="C:\Program Files\Java\jdk-9"). NetBeans wouldn't start, so I checked with the command line and saw I was getting

java.lang.RuntimeException: Unknown module: jdk.internal.jvmstat at jdk.internal.module.ModuleBootstrap.fail(java.base@9-ea/ModuleBootstrap.java:566) at jdk.internal.module.ModuleBootstrap.addExtraExports(java.base@9-ea/ModuleBootstrap.java:480) at jdk.internal.module.ModuleBootstrap.boot(java.base@9-ea/ModuleBootstrap.java:319) at java.lang.System.initPhase2(java.base@9-ea/System.java:1927)

so I meddled with the _netbeans_defaultoptions, removing -J--add-exports=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED. My eyes don't hurt anymore! Ahh I hope the NetBeans team will consider making HighDPI icons as well (and fix the bugs related to running with JDK 9).

Blog Comments powered by Disqus.