this is caused by encapsulation violations of the java module system,
see JEP 396. If you run it on JDK 15 or older, you should see warnings,
anything after that will throw exceptions.
Some NetBeans modules need direct access to JDK modules.
NetBeans-the-IDE sets the following flags:
https://github.com/apache/netbeans/tree/master/nbbuild/jms-config
NetBeans RCP apps won't need all of those flags, since they usually use
a subset of the modules NetBeans uses.
there should be many blog entries online about this topic since it isn't
really NB specific,
best regards,
michael
On 16.02.23 11:34, Claudio Rosati wrote:
Hello all,
After some years not using NetBeans RCP (only de IDE), I’ve tried to follow the
"NetBeans Platform Quick Start Using Maven” using NetBeans 16 with Java 19.
When I try to "Build with Dependencies” the app the following error appears at
compilation time:
Running es.intellectusetanima.mavenplatformwordapp.ApplicationTest
Feb 14, 2023 1:09:17 PM org.netbeans.ProxyURLStreamHandlerFactory register
SEVERE: No way to find original stream handler for jar protocol
java.lang.reflect.InaccessibleObjectException: Unable to make field transient
java.net.URLStreamHandler java.net.URL.handler accessible: module java.base does not
"opens java.net" to unnamed module @7e0ea639
at
java.base/java.lang.reflect.AccessibleObject.throwInaccessibleObjectException(AccessibleObject.java:387)
at
java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:363)
at
java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:311)
at
java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:180)
at java.base/java.lang.reflect.Field.setAccessible(Field.java:174)
at
org.netbeans.ProxyURLStreamHandlerFactory.register(ProxyURLStreamHandlerFactory.java:59)
at org.netbeans.JarClassLoader.<clinit>(JarClassLoader.java:142)
at org.netbeans.MainImpl.execute(MainImpl.java:153)
at org.netbeans.MainImpl.main(MainImpl.java:60)
at org.netbeans.Main.main(Main.java:58)
at
java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at
org.netbeans.junit.NbModuleSuite$S.runInRuntimeContainer(NbModuleSuite.java:906)
at org.netbeans.junit.NbModuleSuite$S.access$100(NbModuleSuite.java:661)
at org.netbeans.junit.NbModuleSuite$S$1.protect(NbModuleSuite.java:682)
at junit.framework.TestResult.runProtected(TestResult.java:142)
at org.netbeans.junit.NbModuleSuite$S.run(NbModuleSuite.java:678)
at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:90)
at
org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at
java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at
org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at
org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at
org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:113)
at
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
If I try to run the app, I have the previous error plus the following:
java.lang.IllegalAccessException: class org.netbeans.TopSecurityManager cannot
access class sun.awt.AppContext (in module java.desktop) because module
java.desktop does not export sun.awt to unnamed module @5cc73178
at
java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:420)
at
java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:709)
at java.base/java.lang.reflect.Method.invoke(Method.java:569)
at
org.netbeans.TopSecurityManager.makeSwingUseSpecialClipboard(TopSecurityManager.java:714)
at
org.netbeans.core.NbLifecycleManager.advancePolicy(NbLifecycleManager.java:71)
at org.netbeans.core.GuiRunLevel.run(GuiRunLevel.java:84)
at org.netbeans.core.startup.Main.start(Main.java:316)
at org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:98)
at java.base/java.lang.Thread.run(Thread.java:1589)
Anyway, the application starts.
The same happens using the alternative way of building an RCP app (i.e. using
Ant-based development, as in NetBeans Platform Quick Start for NetBeans
Platform).
Now, how can I get rid of these errors? Do I need a moodule-info.java file? If
yes, where? Otherwise?
Claudio
_____________________________
Claudio Rosati
Calle Tamara 7
Villa Jinámar
35220 Telde, Gran Canaria
España
Skype: claudio.rosati
Phone: +34 638 579 990 (mobile)
E-mail: claudio.ros...@mac.com
_____________________________
EMAIL CONFIDENTIALITY NOTICE
This message is private and confidential.
If you have received this message in error,
please notify me and remove it from your system.
_____________________________
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@netbeans.apache.org
For additional commands, e-mail: dev-h...@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists