-
Bug
-
Resolution: Not an Issue
-
P4
-
9
-
x86
-
os_x
FULL PRODUCT VERSION :
java version "9"
Java(TM) SE Runtime Environment (build 9+181)
Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Darwin Macintosh.local 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64
A DESCRIPTION OF THE PROBLEM :
I have been having problems accessing the jdk.jshell api's from my code. I am not sure if this is because of using a different classloader than commandline, which works, or because the application runs the code using reflection on a different thread. Or for some reason application just requires module access.
I thought I would try the --add-exports option.
I added to the application plist.
Getting this if run command line...
java --add-exports jdk.jshell/jdk.jshell=ALL-UNNAMED -cp halfpipe.jar JShellTester
shell jdk.jshell.JShell@45afc369
[It doesn't need the option command line, but doesn't object to it either]
This if run from an application....
./HalfPipe7.app/Contents/MacOS/JavaAppLauncher
Unrecognized option: --add-exports jdk.jshell/jdk.jshell=ALL-UNNAMED
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
If that isn't present the application will launch with Java 9 as the following command entered from the application, a java shell, shows.
versions
System.in:3:java.version=9
System.in:15:java.class.version=53.0
System.in:17:java.vm.specification.version=9
System.in:20:java.vm.version=9+181
System.in:23:java.runtime.version=9+181
System.in:26:java.specification.version=9
This shows how this looks in the OS X info.plist file
<key>JVMOptions</key>
<array>
<string>--add-exports java.management/sun.management=ALL-UNNAMED</string>
except here I tried pasting in the exact example from the migration guide.
Same result...
./HalfPipe7.app/Contents/MacOS/JavaAppLauncher
Unrecognized option: --add-exports java.management/sun.management=ALL-UNNAMED
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Add a --add-exports to the Info.plist for a OS X JavaAppLauncher application.
If I am correct it should not launch.
Entering this for your corresponding application...
./HalfPipe7.app/Contents/MacOS/JavaAppLauncher
Should show the --add-exports as an Unrecognized option:
and again fail to launch.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The application launches with access granted to the exported module/package
ACTUAL -
The application fails to launch.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Unrecognized option: --add-exports jdk.jshell/jdk.jshell=ALL-UNNAMED
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Source code not available. Any application you can change the Info.plist for should be a suitable test case.
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Don't use the option but then I still have to determine why I can't access the module/package.
java version "9"
Java(TM) SE Runtime Environment (build 9+181)
Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Darwin Macintosh.local 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64
A DESCRIPTION OF THE PROBLEM :
I have been having problems accessing the jdk.jshell api's from my code. I am not sure if this is because of using a different classloader than commandline, which works, or because the application runs the code using reflection on a different thread. Or for some reason application just requires module access.
I thought I would try the --add-exports option.
I added to the application plist.
Getting this if run command line...
java --add-exports jdk.jshell/jdk.jshell=ALL-UNNAMED -cp halfpipe.jar JShellTester
shell jdk.jshell.JShell@45afc369
[It doesn't need the option command line, but doesn't object to it either]
This if run from an application....
./HalfPipe7.app/Contents/MacOS/JavaAppLauncher
Unrecognized option: --add-exports jdk.jshell/jdk.jshell=ALL-UNNAMED
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
If that isn't present the application will launch with Java 9 as the following command entered from the application, a java shell, shows.
versions
System.in:3:java.version=9
System.in:15:java.class.version=53.0
System.in:17:java.vm.specification.version=9
System.in:20:java.vm.version=9+181
System.in:23:java.runtime.version=9+181
System.in:26:java.specification.version=9
This shows how this looks in the OS X info.plist file
<key>JVMOptions</key>
<array>
<string>--add-exports java.management/sun.management=ALL-UNNAMED</string>
except here I tried pasting in the exact example from the migration guide.
Same result...
./HalfPipe7.app/Contents/MacOS/JavaAppLauncher
Unrecognized option: --add-exports java.management/sun.management=ALL-UNNAMED
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Add a --add-exports to the Info.plist for a OS X JavaAppLauncher application.
If I am correct it should not launch.
Entering this for your corresponding application...
./HalfPipe7.app/Contents/MacOS/JavaAppLauncher
Should show the --add-exports as an Unrecognized option:
and again fail to launch.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The application launches with access granted to the exported module/package
ACTUAL -
The application fails to launch.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Unrecognized option: --add-exports jdk.jshell/jdk.jshell=ALL-UNNAMED
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Source code not available. Any application you can change the Info.plist for should be a suitable test case.
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Don't use the option but then I still have to determine why I can't access the module/package.