Ok, I just tried it and I don't see the --add-reads changing the behavior as I would
expect:
[URLClassLoader 558]$ $JAVA9_HOME/bin/java -version
java version "9-ea"
Java(TM) SE Runtime Environment (build 9-ea+126-2016-07-10-165150.javare.5266.nc)
Java HotSpot(TM) 64-Bit Server VM (build 9-ea+126-2016-07-10-165150.javare.5266.nc, mixed
mode)
[URLClassLoader 557]$ $JAVA9_HOME/bin/java -Xdiag --add-reads java.sql=java.base -cp bin
TestURLClassLoader
...
[Resolver] jdk.zipfs
rootURL=file:/private/tmp/URLClassLoader/bin/
Loaded class: class JavaSqlUser, loader=java.net.URLClassLoader@51565ec2
Exception in thread "main" java.lang.reflect.InvocationTargetException
at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(java.base@9-ea/Native
Method)
at
jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(java.base@9-ea/NativeConstructorAccessorImpl.java:62)
at
jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(java.base@9-ea/DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(java.base@9-ea/Constructor.java:453)
at TestURLClassLoader.main(TestURLClassLoader.java:26)
Caused by: java.lang.NoClassDefFoundError: java/sql/Date
at SqlDateUser.<init>(SqlDateUser.java:7)
at JavaSqlUser.<init>(JavaSqlUser.java:12)
... 5 more
Caused by: java.lang.ClassNotFoundException: java.sql.Date
at java.net.URLClassLoader.findClass(java.base@9-ea/URLClassLoader.java:384)
at java.lang.ClassLoader.loadClass(java.base@9-ea/ClassLoader.java:486)
at java.lang.ClassLoader.loadClass(java.base@9-ea/ClassLoader.java:419)
... 7 more
----- Original Message -----
From: "Tomaž Cerar" <tomaz.cerar(a)gmail.com>
To: "Scott Stark" <sstark(a)redhat.com>
Cc: wildfly-dev(a)lists.jboss.org
Sent: Monday, July 11, 2016 12:22:34 PM
Subject: Re: [wildfly-dev] common cdi-tck problem on wildfly with java 9
On Mon, Jul 11, 2016 at 7:48 PM, Scott Stark <sstark(a)redhat.com> wrote:
[tmp 512]$ java -version
java version "9-ea"
Java(TM) SE Runtime Environment (build 9-ea+126)
Java HotSpot(TM) 64-Bit Server VM (build 9-ea+126, mixed mode)
You are using "wrong" b126, this is from main line, grab b126 jigsaw build
that was just published to
https://jdk9.java.net/jigsaw/
C:\development\tools\jdk\jdk-9\bin> ./java -version
java version "9-ea"
Java(TM) SE Runtime Environment (build 9-ea+
126-2016-07-10-164835.javare.5266.nc)
Java HotSpot(TM) Client VM (build 9-ea+126-2016-07-10-164835.javare.5266.nc,
mixed mode)