Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JPMS related VM configurations cannot be set #56

Closed
amitjoy opened this issue Apr 6, 2022 · 7 comments
Closed

JPMS related VM configurations cannot be set #56

amitjoy opened this issue Apr 6, 2022 · 7 comments

Comments

@amitjoy
Copy link

amitjoy commented Apr 6, 2022

With the introduction of jpms, new java options are introduced:

  • With --add-exports the package is exported, meaning all public types and members therein are accessible at compile and run time.
  • With --add-opens the package is opened, meaning all types and members (not only public ones!) therein are accessible at run time.

In https://www.jdeploy.com/~osgifx application, I need the following java options to be set as well to make it work:

"args": [
            "--add-exports=javafx.base/com.sun.javafx.event=ALL-UNNAMED",
            "--add-exports=javafx.base/com.sun.javafx.runtime=ALL-UNNAMED",
            "--add-exports=javafx.graphics/com.sun.glass.ui=ALL-UNNAMED",
            "--add-exports=javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED",
            "--add-exports=javafx.graphics/com.sun.javafx.application=ALL-UNNAMED",
            "--add-exports=javafx.graphics/com.sun.glass.ui=ALL-UNNAMED",
            "--add-exports=javafx.graphics/com.sun.javafx.css=ALL-UNNAMED",
            "--add-opens=javafx.graphics/javafx.scene=ALL-UNNAMED",
            "--add-opens=javafx.controls/javafx.scene.control.skin=ALL-UNNAMED"
        ],

These options are still not set while running the application by either double clicking on it or by running the executable directly from the command line.

@amitjoy
Copy link
Author

amitjoy commented Apr 6, 2022

The following is the one of the exceptions that appears during the launch if the aforementioned options ain't set while starting the VM

java.lang.IllegalAccessError: class org.eclipse.fx.ui.workbench.fx.DefaultJFXApp (in unnamed module @0x200cd34) cannot access class com.sun.glass.ui.Application (in module javafx.graphics) because module javafx.graphics does not export com.sun.glass.ui to unnamed module @0x200cd34
	at org.eclipse.fx.ui.workbench.fx.DefaultJFXApp.setProductApplicationName(DefaultJFXApp.java:82)
	at org.eclipse.fx.ui.workbench.fx.DefaultJFXApp.<init>(DefaultJFXApp.java:54)
	at org.eclipse.fx.ui.workbench.fx.DefaultJFXApp.<init>(DefaultJFXApp.java:39)
	at com.osgifx.console.application.ConsoleFxStage.<init>(ConsoleFxStage.java:41)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Unknown Source)
	at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source)
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(Unknown Source)
	at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(Unknown Source)
	at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Unknown Source)
	at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(Unknown Source)
	at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)

@shannah
Copy link
Owner

shannah commented Apr 6, 2022

Your args are added, but perhaps it's adding them in the wrong order. Can you share the command-line java command you would typically use to run your app in the command-line, including these args?

@amitjoy
Copy link
Author

amitjoy commented Apr 6, 2022

The following is an example of running the gradle daemon -

java --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.base/java.nio.charset=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED -XX:MaxMetaspaceSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country=IN -Duser.language=en -Duser.variant -cp /Users/amit/.gradle/wrapper/dists/gradle-7.3-bin/ddwl0k7mt9g6ak16i1m905vyv/gradle-7.3/lib/gradle-launcher-7.3.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 7.3

@amitjoy
Copy link
Author

amitjoy commented Apr 6, 2022

I just tried to publish a new version of the application with the following runtime arguments -

"--add-exports javafx.base/com.sun.javafx.event=ALL-UNNAMED",
            "--add-exports javafx.base/com.sun.javafx.runtime=ALL-UNNAMED",
            "--add-exports javafx.graphics/com.sun.glass.ui=ALL-UNNAMED",
            "--add-exports javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED",
            "--add-exports javafx.graphics/com.sun.javafx.application=ALL-UNNAMED",
            "--add-exports javafx.graphics/com.sun.glass.ui=ALL-UNNAMED",
            "--add-exports javafx.graphics/com.sun.javafx.css=ALL-UNNAMED",
            "--add-opens javafx.graphics/javafx.scene=ALL-UNNAMED",
            "--add-opens javafx.controls/javafx.scene.control.skin=ALL-UNNAMED"

It still behaves the same. I also think the ordering is wrong.

@amitjoy
Copy link
Author

amitjoy commented Apr 6, 2022

This is how I run the application from the executable jar without any problem:

java --add-exports javafx.base/com.sun.javafx.event=ALL-UNNAMED --add-exports javafx.base/com.sun.javafx.runtime=ALL-UNNAMED --add-exports javafx.graphics/com.sun.glass.ui=ALL-UNNAMED --add-exports javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED --add-exports javafx.graphics/com.sun.javafx.application=ALL-UNNAMED --add-exports javafx.graphics/com.sun.glass.ui=ALL-UNNAMED --add-exports javafx.graphics/com.sun.javafx.css=ALL-UNNAMED --add-opens javafx.graphics/javafx.scene=ALL-UNNAMED --add-opens javafx.controls/javafx.scene.control.skin=ALL-UNNAMED -jar osgifx.jar

@shannah
Copy link
Owner

shannah commented Apr 7, 2022

I've just pushed out a new version that fixes this issue. I've tested it on your app. You don't need to republish, but you do need to download the installer again from the download page to get the change.

@shannah shannah closed this as completed Apr 7, 2022
@amitjoy
Copy link
Author

amitjoy commented Apr 7, 2022

@shannah Thanks a lot for your continuous support. I have tested it and it works like a charm 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants