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

Exception in thread "FXLauncher-Thread" java.lang.IllegalAccessError: class fxlauncher.Launcher$1 (in module fxlauncher) cannot access class com.sun.javafx.application.PlatformImpl (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.application to module fxlauncher #202

Open
edovale opened this issue Apr 14, 2022 · 1 comment

Comments

@edovale
Copy link

edovale commented Apr 14, 2022

Hi,

I have been banging my head trying to figure this problem out. The error message is self-explanatory. It seems fxlauncher is attempting to access a non exported class.

What is a way to solve this problem?

Command being ran:

java -Djava.system.class.loader=fxlauncher.FxlauncherClassCloader 
   --add-modules java.xml.bind,javafx.base,javafx.fxml,javafx.controls,javafx.graphics,javafx.web 
   -Dfile.encoding=UTF-8 
   -classpath 
          code/src/javafx-agent/target/classes:
          .m2/repository/com/microsoft/sqlserver/mssql-jdbc/10.2.0.jre17/mssql-jdbc-10.2.0.jre17.jar:
          .m2/repository/org/slf4j/jcl-over-slf4j/2.0.0-alpha7/jcl-over-slf4j-2.0.0-alpha7.jar:
          .m2/repository/org/slf4j/slf4j-api/2.0.0-alpha7/slf4j-api-2.0.0-alpha7.jar:
          .m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.1/jaxb-runtime-2.3.1.jar:
          .m2/repository/org/glassfish/jaxb/txw2/2.3.1/txw2-2.3.1.jar:
          .m2/repository/com/sun/istack/istack-commons-runtime/3.0.7/istack-commons-runtime-3.0.7.jar:
          .m2/repository/org/jvnet/staxex/stax-ex/1.8/stax-ex-1.8.jar:
          .m2/repository/com/sun/xml/fastinfoset/FastInfoset/1.2.15/FastInfoset-1.2.15.jar:
          .m2/repository/javax/activation/javax.activation-api/1.2.0/javax.activation-api-1.2.0.jar:
          .m2/repository/javax/xml/bind/jaxb-api/2.3.1/jaxb-api-2.3.1.jar 
-p 
         javafx-agent/target/app 
-m 
         fxlauncher/fxlauncher.Launcher --app=javafx-agent/target/app/app.xml```

Here is the stacktrace I am getting:

OpenJDK 64-Bit Server VM warning: Archived non-system classes are disabled because the java.system.class.loader property is specified (value = "fxlauncher.FxlauncherClassCloader"). To use archived non-system classes, this property must not be set
logging to /var/folders/8q/ln9l7ksj3fn8419bb09l3gxm0000gn/T//fxlauncher.log
Apr. 14, 2022 4:04:07 P.M. fxlauncher.AbstractLauncher syncManifest
INFO: Loading manifest from 'app' parameter supplied: javafx-agent/target/app/app.xml/
Apr. 14, 2022 4:04:08 P.M. fxlauncher.AbstractLauncher syncFiles
INFO: Using cache dir .
Apr. 14, 2022 4:04:08 P.M. fxlauncher.AbstractLauncher createApplicationEnvironment
INFO: Loading appClass ai.dentacloud.dentacloudagent.DentacloudApplication
Exception in thread "FXLauncher-Thread" java.lang.IllegalAccessError: class fxlauncher.Launcher$1 (in module fxlauncher) cannot access class com.sun.javafx.application.PlatformImpl (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.application to module fxlauncher
	at fxlauncher/fxlauncher.Launcher$1.createApplication(Launcher.java:51)
	at fxlauncher/fxlauncher.AbstractLauncher.createApplicationEnvironment(AbstractLauncher.java:176)
	at fxlauncher/fxlauncher.Launcher.lambda$start$0(Launcher.java:158)
	at java.base/java.lang.Thread.run(Thread.java:833)

@ygarg465
Copy link

ygarg465 commented Nov 8, 2022

Hey @edovale , You can easily solve this issue by adding this line --add-exports javafx.graphics/com.sun.javafx.application=ALL-UNNAMED after --add-modules. And any similar future issue can be resolved using this same pattern. It works for exports and opens problem

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