Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

java.lang.ClassNotFoundException: com.sun.prism.es2.X11GLFactory + Fix #8

Open
1fexd opened this issue Apr 16, 2021 · 3 comments
Open

Comments

@1fexd
Copy link

1fexd commented Apr 16, 2021

Hi,

thanks for this great library.
When I first added it to my project, it threw this exception:

GLFactory.static - Platform: Linux - not available: com.sun.prism.es2.X11GLFactory
java.lang.ClassNotFoundException: com.sun.prism.es2.X11GLFactory
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:315)
	at javafx.graphics/com.sun.prism.es2.GLFactory$FactoryLoader.run(GLFactory.java:110)
	at javafx.graphics/com.sun.prism.es2.GLFactory$FactoryLoader.run(GLFactory.java:100)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at javafx.graphics/com.sun.prism.es2.GLFactory.<clinit>(GLFactory.java:97)
	at javafx.graphics/com.sun.prism.es2.ES2Pipeline.<clinit>(ES2Pipeline.java:77)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:315)
	at javafx.graphics/com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:218)
	at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:91)
	at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
	at java.base/java.lang.Thread.run(Thread.java:834)
java.lang.ClassNotFoundException: com.sun.glass.ui.gtk.GtkPlatformFactory
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:315)
	at javafx.graphics/com.sun.glass.ui.PlatformFactory.getPlatformFactory(PlatformFactory.java:42)
	at javafx.graphics/com.sun.glass.ui.Application.run(Application.java:144)
	at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:280)
	at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:288)
	at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:160)
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658)
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:409)
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
Failed to load Glass factory class
Exception in thread "main" java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
Caused by: java.lang.NullPointerException
	at javafx.graphics/com.sun.glass.ui.Application.run(Application.java:144)
	at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:280)
	at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:288)
	at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:160)
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658)
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:409)
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
	... 5 more

Caused by: java.lang.NullPointerException

Because I have struggled with dependencies which have JavaFX as their own dependency before, I was able to fix this error by declaring the dependency like this:

implementation("com.sandec:mdfx:0.1.8") {
   exclude group: "org.openjfx"
}

I suggest you add it to your readme in some form. Also, in the readme, your repo uses http instead of https. Also also, the link to the example is broken in the readme.

@FlorianKirmaier
Copy link
Contributor

Thank you for the feedback, I've compared it with other projects, they seem to not declare the JavaFX dependency, so I will do it too in the next version.

@FlorianKirmaier
Copy link
Contributor

I've reinvestigated it. We currently use the gradle-javafx-plugin, and I don't want to add any changes on what they are doing. I didn't had to exclude JavaFX on any of my many JavaFX projects. Are you using Java8?

@1fexd
Copy link
Author

1fexd commented Apr 22, 2021

Nope, I am using Java 11 + JavaFX 16 with Java's module system and the org.openjfx.javafxplugin gradle plugin

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

No branches or pull requests

2 participants