<目次>
(1) jarファイル実行で「java.lang.ClassNotFoundException: com.sun.prism.es2.X11GLFactory」が出る原因と対策
(1-1) エラーメッセージ・発生状況
(1-2) 原因
(1-3) 対策
(1) jarファイル実行で「java.lang.ClassNotFoundException: com.sun.prism.es2.X11GLFactory」が出る原因と対策
(1-1) エラーメッセージ・発生状況
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:606) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168) 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:377) at com.sun.prism.es2.GLFactory$FactoryLoader.run(GLFactory.java:110) at com.sun.prism.es2.GLFactory$FactoryLoader.run(GLFactory.java:100) at java.base/java.security.AccessController.doPrivileged(AccessController.java:312) at com.sun.prism.es2.GLFactory.(GLFactory.java:97) at com.sun.prism.es2.ES2Pipeline.(ES2Pipeline.java:77) at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:377) at com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:218) at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:91) at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124) at java.base/java.lang.Thread.run(Thread.java:832) java.lang.ClassNotFoundException: com.sun.glass.ui.gtk.GtkPlatformFactory at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168) 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:377) at com.sun.glass.ui.PlatformFactory.getPlatformFactory(PlatformFactory.java:42) at com.sun.glass.ui.Application.run(Application.java:144) at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:280) at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:269) at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:158) at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658) at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:678) at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195) at java.base/java.lang.Thread.run(Thread.java:832) Failed to load Glass factory class Exception in thread "main" java.lang.NullPointerException: Cannot invoke "com.sun.glass.ui.PlatformFactory.createApplication()" because the return value of "com.sun.glass.ui.PlatformFactory.getPlatformFactory()" is null at com.sun.glass.ui.Application.run(Application.java:144) at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:280) at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:269) at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:158) at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658) at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:678) at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195) at java.base/java.lang.Thread.run(Thread.java:832)
(図111①)
●参考情報
HH:MM:SS INFO Runner - Detected 64 bit Windows HH:MM:SS INFO Runner - Using winutils.exe as binary java.lang.ClassNotFoundException: com.sun.glass.ui.win.WinPlatformFactory
(1-2) 原因
(1-3) 対策
java -jar XXXXX.jar
java --module-path "[ご自身のJava FXライブラリ格納パス]" --add-modules javafx.controls,javafx.fxml -jar XXXXX.jar
●補足
Java FXのUIツールキットで利用できるチャート部品やUI制御を提供します。
XML形式の一つで、Java FXのGUI部品をHTMLに似た方法でページとして1つに纏めることができます。そのため、FXMLはJava FXのレイアウトを残りのアプリケーション部分と分断する事ができます。
<?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.layout.VBox?> <?import javafx.scene.control.Label?> <VBox> <children> <Label text=" FXML Hello world Sample"/> </children> </VBox>