The Java Module System (sometimes also called JPMS) encapsulates modules and prevents applications from accessing JDK internals (JEP 260, JEP 396, JEP 403).

NetBeans has to break this encapsulation occasionally and therefore sets JVM flags to override the default.

The list of JVM options NetBeans itself sets can be found here:

(those will land in your netbeans.conf and ensure that NetBeans can run on modern JDKs)

The same rule applies to any application, like for example a NetBeans platform application. The concrete set of options however highly depends on what dependencies the application actually uses and also what it does at runtime (some might not need any flags).

If you see exceptions like this:

java.lang.reflect.InaccessibleObjectException: Unable to make field transient accessible: module java.base does not "opens" to unnamed module @2e0fa5d3
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(
	at java.base/java.lang.reflect.Field.checkCanSetAccessible(
	at java.base/java.lang.reflect.Field.setAccessible(
	at org.netbeans.ProxyURLStreamHandlerFactory.register(
	at org.netbeans.JarClassLoader.<clinit>(
	at org.netbeans.MainImpl.execute(
	at org.netbeans.MainImpl.main(
	at org.netbeans.Main.main(

you probably have to set some flags too! (--add-opens=java.base/ in this example)

There are many blog entries about this issue since it is fairly common and not unique to NetBeans platform applications:


  • No labels