Home > Software design >  Netbeans: Unexpected Exception
Netbeans: Unexpected Exception

Time:10-25

I installed Apache Netbeans on my PC. And everything worked fine. But the next day i wanted to go on with my work, but since then i am getting all the time an exception:

A java.lang.IllegalAccessError exception has occurred.
Please report this at https://issues.apache.org/jira/projects/NETBEANS/issues,
including a copy of your messages.log file as an attachment.
The messages.log file is located in your 
C:\Users\svent\AppData\Roaming\NetBeans\12.0\var\log folder.

I have the follwoing settings:

Product version: Apache NetBeans IDE 12.0

Java: 17; OpenJDK 64-Bit Server VM 17 35-2724

System: Windows 10 amd64

I have tried to uninstall everything and install it again. I also tried out to use Java 11 or Java 14. I also have tried to delete the 12.0 folder from netbeans in the AppData. But none of this helped.

Here is the exact Exeption:

java.lang.IllegalAccessError: superclass access check failed: class org.netbeans.lib.nbjavac.services.CancelAbort (in unnamed module @0x6a51d5d0) 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 @0x6a51d5d0
    at java.base/java.lang.ClassLoader.defineClass1(Native Method)
    at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1012)
    at org.netbeans.JarClassLoader.doLoadClass(JarClassLoader.java:287)
    at org.netbeans.ProxyClassLoader.selfLoadClass(ProxyClassLoader.java:246)
    at org.netbeans.ProxyClassLoader.doFindClass(ProxyClassLoader.java:174)
    at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:125)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
    at org.netbeans.modules.java.source.parsing.JavacParserFactory.createPrivateParser(JavacParserFactory.java:79)
    at org.netbeans.api.java.source.JavaSource$JavaSourceAccessorImpl.createCompilationController(JavaSource.java:739)
    at org.netbeans.modules.java.source.JavaSourceUtilImpl.getModuleInfoHandle(JavaSourceUtilImpl.java:271)
    at org.netbeans.modules.java.preprocessorbridge.spi.JavaSourceUtilImpl$MyAccessor.getModuleInfoHandle(JavaSourceUtilImpl.java:119)
    at org.netbeans.modules.java.preprocessorbridge.api.ModuleUtilities.init(ModuleUtilities.java:122)
    at org.netbeans.modules.java.preprocessorbridge.api.ModuleUtilities.resolveModule(ModuleUtilities.java:104)
    at org.netbeans.modules.java.api.common.classpath.ModuleClassPaths$ModuleInfoClassPathImplementation.getResources(ModuleClassPaths.java:882)
    at org.netbeans.api.java.classpath.ClassPath.entries(ClassPath.java:363)
    at org.netbeans.spi.java.classpath.support.MuxClassPathImplementation.getResources(MuxClassPathImplementation.java:90)
    at org.netbeans.api.java.classpath.ClassPath$SPIListener.propertyChange(ClassPath.java:1343)
    at org.openide.util.WeakListenerImpl$PropertyChange.propertyChange(WeakListenerImpl.java:190)
    at java.desktop/java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:343)
    at java.desktop/java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:335)
    at java.desktop/java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:268)
    at org.netbeans.spi.java.classpath.support.MuxClassPathImplementation.propertyChange(MuxClassPathImplementation.java:127)
    at org.openide.util.WeakListenerImpl$PropertyChange.propertyChange(WeakListenerImpl.java:190)
    at java.desktop/java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:343)
    at java.desktop/java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:335)
    at java.desktop/java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:268)
    at org.netbeans.modules.java.api.common.classpath.ClassPathProviderImpl$SourceLevelSelector.propertyChange(ClassPathProviderImpl.java:1575)
    at org.openide.util.WeakListenerImpl$PropertyChange.propertyChange(WeakListenerImpl.java:190)
    at java.desktop/java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:343)
    at java.desktop/java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:335)
    at org.netbeans.spi.project.support.ant.SequentialPropertyEvaluator.stateChanged(SequentialPropertyEvaluator.java:185)
    at org.openide.util.WeakListenerImpl$Change.stateChanged(WeakListenerImpl.java:331)
    at org.openide.util.ChangeSupport.fireChange(ChangeSupport.java:108)
    at org.openide.util.ChangeSupport.fireChange(ChangeSupport.java:94)
    at org.netbeans.spi.project.support.ant.ProjectProperties$PP$2.run(ProjectProperties.java:365)
    at org.netbeans.spi.project.support.ant.ProjectProperties$PP$2.run(ProjectProperties.java:363)
    at org.netbeans.modules.openide.util.DefaultMutexImplementation.readAccess(DefaultMutexImplementation.java:188)
    at org.openide.util.Mutex.readAccess(Mutex.java:193)
    at org.netbeans.spi.project.support.ant.ProjectProperties$PP.fireChange(ProjectProperties.java:371)
    at org.netbeans.spi.project.support.ant.ProjectProperties$PP.put(ProjectProperties.java:225)
    at org.netbeans.spi.project.support.ant.ProjectProperties.putProperties(ProjectProperties.java:107)
    at org.netbeans.spi.project.support.ant.AntProjectHelper$6.run(AntProjectHelper.java:740)
    at org.netbeans.spi.project.support.ant.AntProjectHelper$6.run(AntProjectHelper.java:738)
    at org.netbeans.modules.openide.util.DefaultMutexImplementation.writeAccess(DefaultMutexImplementation.java:229)
    at org.openide.util.Mutex.writeAccess(Mutex.java:246)
    at org.netbeans.spi.project.support.ant.AntProjectHelper.putProperties(AntProjectHelper.java:738)
    at org.netbeans.modules.java.j2seproject.api.J2SEProjectBuilder.createProject(J2SEProjectBuilder.java:579)
    at org.netbeans.modules.java.j2seproject.api.J2SEProjectBuilder.lambda$build$0(J2SEProjectBuilder.java:312)
    at org.openide.filesystems.EventControl.runAtomicAction(EventControl.java:102)
    at org.openide.filesystems.FileSystem.runAtomicAction(FileSystem.java:494)
    at org.netbeans.modules.java.j2seproject.api.J2SEProjectBuilder.build(J2SEProjectBuilder.java:310)
    at org.netbeans.modules.java.j2seproject.J2SEProjectGenerator.createProject(J2SEProjectGenerator.java:59)
    at org.netbeans.modules.java.j2seproject.ui.wizards.NewJ2SEProjectWizardIterator.instantiate(NewJ2SEProjectWizardIterator.java:187)
    at org.openide.loaders.TemplateWizard$InstantiatingIteratorBridge.instantiate(TemplateWizard.java:1048)
    at org.openide.loaders.TemplateWizard.handleInstantiate(TemplateWizard.java:602)
    at org.netbeans.modules.project.ui.NewProjectWizard.handleInstantiate(NewProjectWizard.java:51)
    at org.openide.loaders.TemplateWizard.instantiateNewObjects(TemplateWizard.java:436)
    at org.openide.loaders.TemplateWizardIterImpl.instantiate(TemplateWizardIterImpl.java:228)
    at org.openide.loaders.TemplateWizardIteratorWrapper$ProgressInstantiatingIterator.instantiate(TemplateWizardIteratorWrapper.java:155)
    at org.openide.WizardDescriptor.callInstantiateOpen(WizardDescriptor.java:1602)
    at org.openide.WizardDescriptor.callInstantiate(WizardDescriptor.java:1546)
    at org.openide.WizardDescriptor.access$2300(WizardDescriptor.java:67)
    at org.openide.WizardDescriptor$Listener$2$1.run(WizardDescriptor.java:2233)
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
    at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
    at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)

I hope someone can help me with this, because i don't know what to do anymore.

CodePudding user response:

You are running NetBeans 12.0 with JDK 17. This is not a supported combination.

You have two options:

  • Stick with NetBeans 12.0, and use JDK 14 instead.
  • Stick with JDK 17, and use NetBeans 12.5 instead. (In this case you don't need to uninstall NetBeans 12.0 first.)

See the release notes for NetBeans 12.0 and NetBeans 12.5 for details on which versions of Java are supported.

Questions similar to this one are common here, and it's unfortunate that NetBeans doesn't do a better job of proactively preventing unsupported JDKs from being used. That said, in NetBeans defense:

  • The error message you posted was explicitly referring you to the NetBeans log file (messages.log) for further information.
  • The NetBeans Release Notes always explicitly state which versions of Java are supported for a given NetBeans release, and no assumptions should be made. For example, in the case of NetBeans 12.5 the supported releases are "JDK LTS releases 8 and 11, with experimental support for JDK 17". That information is important, because it shows that although JDK 17 has "experimental support", releases JDK 12 through JDK 16 are not supported.
  • Related