WARNING: Loading FXML document with JavaFX API of version 23.0.1 by JavaFX runtime of version 22.0.1 Exception in Application start method
как решить эту проблему? Просто не особо сильно разбираюсь, но ни одного решения проблемы не нашел
WARNING: Loading FXML document with JavaFX API of version 23.0.1 by JavaFX runtime of version 22.0.1
Exception in Application start method
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:118)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at [email protected]/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:464)
at [email protected]/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:364)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1164)
Caused by: java.lang.RuntimeException: Exception in Application start method
at [email protected]/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:893)
at [email protected]/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
at java.base/java.lang.Thread.run(Thread.java:1575)
Caused by: javafx.fxml.LoadException: No controller specified.
/C:/JAVAP/demo1/target/classes/com/example/demo1/hello-view.fxml:29
at [email protected]/javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2723)
at [email protected]/javafx.fxml.FXMLLoader$Element.getControllerMethodHandle(FXMLLoader.java:570)
at [email protected]/javafx.fxml.FXMLLoader$Element.processEventHandlerAttributes(FXMLLoader.java:612)
at [email protected]/javafx.fxml.FXMLLoader$ValueElement.processEndElement(FXMLLoader.java:783)
at [email protected]/javafx.fxml.FXMLLoader.processEndElement(FXMLLoader.java:2974)
at [email protected]/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2659)
at [email protected]/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2568)
at [email protected]/javafx.fxml.FXMLLoader.load(FXMLLoader.java:2536)
at com.example.demo1/com.example.demo1.HelloApplication.start(HelloApplication.java:14)
at [email protected]/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:839)
at [email protected]/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:483)
at [email protected]/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:456)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
at [email protected]/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:455)
at [email protected]/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at [email protected]/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at [email protected]/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:184)
... 1 more
Exception running application com.example.demo1.HelloApplication
проблема как я понимаю из-за scene builder, уже выбирал jdk 23, но все равно такая же проблема
fxml файл
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.text.Font?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="331.0" prefWidth="339.0" xmlns="http://javafx.com/javafx/23.0.1" xmlns:fx="http://javafx.com/fxml/1">
<children>
<GridPane prefHeight="331.0" prefWidth="339.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Button mnemonicParsing="false" onAction="#btnclick" prefHeight="110.0" prefWidth="258.0" textFill="#0004ff" GridPane.columnIndex="2" GridPane.rowIndex="1">
<font>
<Font name="MV Boli" size="34.0" />
</font>
</Button>
<Button mnemonicParsing="false" onAction="#btnclick" prefHeight="110.0" prefWidth="258.0" textFill="#0004ff" GridPane.columnIndex="2">
<font>
<Font name="MV Boli" size="34.0" />
</font>
</Button>
<Button mnemonicParsing="false" onAction="#btnclick" prefHeight="110.0" prefWidth="258.0" textFill="#0004ff" GridPane.rowIndex="1">
<font>
<Font name="MV Boli" size="34.0" />
</font>
</Button>
<Button mnemonicParsing="false" onAction="#btnclick" prefHeight="110.0" prefWidth="258.0" textFill="#0004ff" GridPane.columnIndex="1">
<font>
<Font name="MV Boli" size="34.0" />
</font>
</Button>
<Button mnemonicParsing="false" onAction="#btnclick" prefHeight="110.0" prefWidth="258.0" textFill="#0004ff" GridPane.columnIndex="1" GridPane.rowIndex="1">
<font>
<Font name="MV Boli" size="34.0" />
</font>
</Button>
<Button mnemonicParsing="false" onAction="#btnclick" prefHeight="110.0" prefWidth="258.0" textFill="#0004ff">
<font>
<Font name="MV Boli" size="34.0" />
</font>
</Button>
<Button mnemonicParsing="false" onAction="#btnclick" prefHeight="110.0" prefWidth="258.0" textFill="#0004ff" GridPane.rowIndex="2">
<font>
<Font name="MV Boli" size="34.0" />
</font>
</Button>
<Button mnemonicParsing="false" onAction="#btnclick" prefHeight="110.0" prefWidth="258.0" textFill="#0004ff" GridPane.columnIndex="1" GridPane.rowIndex="2">
<font>
<Font name="MV Boli" size="34.0" />
</font>
</Button>
<Button mnemonicParsing="false" onAction="#btnclick" prefHeight="110.0" prefWidth="258.0" textFill="#0004ff" GridPane.columnIndex="2" GridPane.rowIndex="2">
<font>
<Font name="MV Boli" size="34.0" />
</font>
</Button>
</children>
</GridPane>
</children>
</AnchorPane>
Ответы (1 шт):
Автор решения: Dmitry
→ Ссылка
Он тебе ругается на отсутствие контроллера. Допиши в первом Anchore Pane: fx:controller="path/to/you/controller".
А на версию JavaFx он тебе просто выкидывает предупреждение, чтобы и этого не было поставь "null" вместо 23.0.1: xmlns="http://javafx.com/javafx/null"