GraalVM版本:21.2.0JavaFX版本:17.0.0.1Maven版本:3.6.3
我非常接近能够运行我的本机映像,我在pom.xml等中向我的反射列表添加了类,但现在我因为resourcebundle未找到错误而陷入停顿。如果有人能给我一个提示,我将不胜感激。
这是我的pom.xml:
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>MyProject-fxml.main</groupId>
<artifactId>MyProject-fxml</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-base</artifactId>
<version>17.0.0.1</version>
<classifier>win</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>17.0.0.1</version>
<classifier>win</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>17.0.0.1</version>
<classifier>win</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>17.0.0.1</version>
<classifier>win</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>22.0.0</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.gluonhq</groupId>
<artifactId>gluonfx-maven-plugin</artifactId>
<version>1.0.6</version>
<configuration>
<mainClass>com.MyProject.Main</mainClass>
<reflectionList>
<list>com.MyProject.MyProject</list>
<list>com.MyProject.controllers.MainViewController</list>
<list>com.MyProject.controllers.stagecontrollers.SimpleStageController</list>
<list>com.MyProject.model.helpers.AppPreferences</list>
<list>com.MyProject.model.helpers.ScreenResolution</list>
<list>javafx.scene.control.SplitPane</list>
<list>javafx.scene.layout.AnchorPane</list>
</reflectionList>
<resourcesList>com.sun.glass.ui.win</resourcesList>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.7</version>
<configuration>
<mainClass>com.MyProject.Main</mainClass>
</configuration>
</plugin>
<!-- TODO: Figure out how to make an executable jar with Maven -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix></classpathPrefix>
<mainClass>com.MyProject.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>run-java</id>
<phase>package</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.MyProject.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
后面跟着错误输出:
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] Oct 09, 2021 11:19:12 AM com.sun.javafx.application.PlatformImpl startup
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @2715644a'
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] Exception in Application start method
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] Oct 09, 2021 11:19:12 AM com.MyProject.APP show
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] SEVERE: There is an error launching the JavaFX runtime, or the application class cannot be constructed (e.g., if the class is not public or is not in an exported package), or an Exception or Error is thrown by the Application constructor, init method, start method, or stop method.java.lang.RuntimeException: Exception in Application start method
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] java.lang.RuntimeException: Exception in Application start method
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:901)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at java.lang.Thread.run(Thread.java:829)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:567)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.oracle.svm.core.windows.WindowsJavaThreads.osThreadStartRoutine(WindowsJavaThreads.java:138)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] Caused by: java.lang.ExceptionInInitializerError
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:315)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at java.lang.Class.ensureInitialized(DynamicHub.java:548)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:260)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at java.lang.reflect.Constructor.newInstance(Constructor.java:490)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at javafx.fxml.FXMLLoader$InstanceDeclarationElement.constructValue(FXMLLoader.java:1020)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:757)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2808)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2634)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2548)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2516)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.MyProject.MyProject.loadMainViewParent(APP.java:88)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.MyProject.MyProject.start(APP.java:55)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:847)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:484)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:457)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at java.security.AccessController.doPrivileged(AccessController.java:105)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:456)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VA_LIST:Ljava_lang_Runnable_2_0002erun_00028_00029V(JNIJavaCallWrappers.java:0)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.sun.glass.ui.win.WinApplication._runLoop(WinApplication.java)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:184)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] ... 3 more
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] Caused by: java.util.MissingResourceException: Can't find bundle for base name com/sun/glass/ui/win/themes, locale en_US
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:2055)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1689)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1593)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1556)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at java.util.ResourceBundle.getBundle(ResourceBundle.java:857)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.sun.glass.ui.win.WinApplication.getHighContrastScheme(WinApplication.java:344)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.sun.glass.ui.win.WinApplication.getHighContrastTheme(WinApplication.java:350)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.sun.javafx.tk.quantum.QuantumToolkit.getThemeName(QuantumToolkit.java:1809)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.sun.javafx.application.PlatformImpl._setPlatformUserAgentStylesheet(PlatformImpl.java:924)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.sun.javafx.application.PlatformImpl.setPlatformUserAgentStylesheet(PlatformImpl.java:723)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.sun.javafx.application.PlatformImpl.setDefaultPlatformUserAgentStylesheet(PlatformImpl.java:687)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at javafx.scene.control.Control.<clinit>(Control.java:99)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:375)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:295)
[Sat Oct 09 11:19:12 CEST 2021][INFO] [SUB] ... 23 more
[Sat Oct 09 11:19:12 CEST 2021][SEVERE] Process run until end failed with result: 1
所以,资源"com sun/glass/ui/win/themes"不见了。然而,我找不到如何纠正这个错误。
多亏了Jose Pereda,将上述bundle从<bundleslist/>
添加到gluonfx-maven-plugin
工作了,即使IntelliJ没有显示此路径具有该名称的bundle。