I just installed Netbeans 12.0. When I started my first project I got an unexpected error message just after creating a new java class. Any suggestions on how I can handle it?
This is the message:
java.lang.IllegalAccessError: superclass access check failed: class org.netbeans.lib.nbjavac.services.CancelAbort (in unnamed module @0x439ece0a) cannot access class com.sun.tools.javac.util.Abort (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.util to unnamed module @0x439ece0a
And this is my System Info:
Product Version = Apache NetBeans IDE 12.0
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 16.0.1; Java HotSpot(TM) 64-Bit Server VM 16.0.1+9-24; Oracle Corporation
Runtime:Java(TM) SE Runtime Environment 16.0.1+9-24
Java Home:c:\program files\java\jdk-16.0.1
System Locale Encoding: pt_BR (nb); Cp1252
Home Directory: C:\Users\User
Current Directory: C:\Program Files\NetBeans-12.0
User Directory: C:\Users\User\AppData\Roaming\NetBeans\12.0
Cache Directory :C:\Users\User\AppData\Local\NetBeans\Cache\12.0
You are using JDK 16, which is unsupported on NetBeans 12.0. From the release documentation for NetBeans 12.0:
You have two options to resolve this:
The second option is preferable because you will get bug fixes for NetBeans, and you can also use a more recent JDK.
FYI, based on the NetBeans release documentation, here is a summary of the JDK versions you can use with all recent versions of NetBeans:
NetBeans 11.0: JDK 8, JDK 11, JDK 12
NetBeans 11.1: JDK 8, JDK 11, JDK 12
NetBeans 11.2: JDK 8, JDK 11, JDK 13
NetBeans 11.3: JDK 8, JDK 11, JDK 14
NetBeans 12.0: JDK 8, JDK 11, JDK 14
NetBeans 12.1: JDK 8, JDK 11, JDK 14
NetBeans 12.2: JDK 8, JDK 11, JDK 15
NetBeans 12.3: JDK 8, JDK 11, JDK 15
NetBeans 12.4: JDK 8, JDK 11, JDK 16
NetBeans 12.5: JDK 8, JDK 11, JDK 17 (n.b. "experimental support")
NetBeans 12.6 is less straightforward: Requires JDK 11+, and officially supports running on JDK 11 and JDK 17, but can be run on JDK 8, with some features disabled, if built from source using JDK 8.
More generally: