Reputation: 1
I'm trying to create a Gluon example based on this repository https://github.com/gluonhq/hello-gluon-ci, the problem I'm having is that it works perfectly in IntelliJ, but when I want to export it to Windows/Android, I encounter the following error
javafx.fxml.LoadException: /cl/home.fxml:10
javafx.fxml.LoadException:
/cl/home.fxml:10
at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2722)
at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:935)
at javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:983)
at javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:230)
at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:757)
at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2853)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2649)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2563)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3376)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3332)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3300)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3272)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3248)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3241)
at cl.MainApp.lambda$init$0(MainApp.java:35)
at com.gluonhq.impl.charm.glisten.util.CachedFactory.get(CachedFactory.java:32)
at com.gluonhq.charm.glisten.application.AppManager.doSwitchView(AppManager.java:787)
at com.gluonhq.charm.glisten.application.AppManager.switchView(AppManager.java:528)
at com.gluonhq.charm.glisten.application.AppManager.switchView(AppManager.java:503)
at com.gluonhq.charm.glisten.application.AppManager.continueInit(AppManager.java:324)
at com.gluonhq.charm.glisten.application.AppManager.start(AppManager.java:288)
at cl.MainApp.start(MainApp.java:67)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:839)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:483)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:456)
at java.security.AccessController.executePrivileged(AccessController.java:169)
at java.security.AccessController.doPrivileged(AccessController.java:399)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:455)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VA_LIST_Runnable_run_16403f8d32adb631126daa893e5e80085c5d6325(JNIJavaCallWrappers.java:0)
at com.sun.glass.ui.win.WinApplication._runLoop(WinApplication.java)
at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:185)
at java.lang.Thread.run(Thread.java:833)
at com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:704)
at com.oracle.svm.core.windows.WindowsPlatformThreads.osThreadStartRoutine(WindowsPlatformThreads.java:143)
Caused by: java.lang.ClassNotFoundException: cl.HomeView
at jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:52)
at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188
According to what I understand from the error, the FXML is not able to find the controller.
home.fxml
<View fx:id="home" xmlns="http://javafx.com/javafx/11"
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="cl.HomeView">
<center>
<StackPane>
<Button text="Click!" onAction="#onClick"/>
<Label text="text" fx:id="text"></Label>
</StackPane>
</center>
</View>
MainApp
appManager.addViewFactory(HOME_VIEW, () -> {
try {
return (View) FXMLLoader.load(getClass().getResource("/cl/home.fxml"));
} catch (Exception ex) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
ex.printStackTrace(pw);
String stackTrace = sw.toString();
System.out.println(stackTrace);
TextArea textArea = new TextArea(stackTrace);
textArea.setMinHeight(450);
return new View(textArea);
}
});
module-info.java
module test {
requires javafx.controls;
requires javafx.fxml;
requires com.gluonhq.attach.util;
requires com.gluonhq.attach.display;
requires java.datatransfer;
requires java.desktop;
requires com.gluonhq.attach.storage;
requires javafx.graphics;
requires java.base;
requires com.gluonhq.charm.glisten;
exports cl;
opens cl to javafx.fxml;
}
my git https://github.com/weichafe/Gluon-cli.git
I would like to know if anyone has had the same error or if it has happened to them
Upvotes: 0
Views: 50