我正试图修复这个错误...但似乎什么都不起作用。在我插入到“www.javafx.com”sample.fxml的超链接之前,应用程序一直运行
```<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.control.skin.SplitPaneSkin.Content?>
<?import javafx.scene.web.WebView?>
<GridPane alignment="center" hgap="10" vgap="10" xmlns="http://javafx.com/javafx/11.0.1"
xmlns:fx="http://javafx.com/fxml/1" fx:controller="sample.Controller" stylesheets="@style.css"
fx:id="gridPane">
<Button text="Open.." fx:id="open" onAction="#handleClick" GridPane.columnIndex="1" GridPane.rowIndex="1"/>
<Button text="Button " fx:id="two" GridPane.columnIndex="2" GridPane.rowIndex="1"/>
<Button text="Button " fx:id="three" GridPane.columnIndex="3" GridPane.rowIndex="1"/>
<Button text="Button " fx:id="four" GridPane.columnIndex="4" GridPane.rowIndex="1"/>
<Button text="Button " fx:id="five" GridPane.columnIndex="5" GridPane.rowIndex="1"/>
<Hyperlink text = "www.javafx.com" GridPane.rowIndex="3" GridPane.columnIndex="0" onAction="#handleLinkClick" />
<WebView GridPane.rowIndex="4" GridPane.columnIndex="0" GridPane.columnSpan="5" GridPane.rowSpan="3"/>
</GridPane> ```
**Main is :**
```public class Main extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
FXMLLoader loader = new FXMLLoader(new File("/Application/sample.fxml").toURI().toURL());
Parent root = loader.load();
primaryStage.setTitle("Test");
primaryStage.setScene(new Scene(root, 600, 275));
primaryStage.show();
;
}
public static void main(String[] args) {
launch(args);
}
}
```
配置了SDK,设置了VM选项,我从javafx导入了所有的包。我还设置了环境变量。所有设置似乎正常..错误是:
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:464)
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:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1071)
Caused by: java.lang.RuntimeException: Exception in Application start method
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.io.FileNotFoundException: D:\Application\sample.fxml (The system cannot find the path specified)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:211)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:153)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:108)
at java.base/sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:86)
at java.base/sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:189)
at java.base/java.net.URL.openStream(URL.java:1167)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2547)
at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:2517)
at JavaFX/sample.Main.start(Main.java:17)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:474)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:447)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:446)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
... 1 more
Exception running application sample.Main ```
而不是写
FXMLLoader loader = new FXMLLoader(new File("/Application/sample.fxml").toURI().toURL());
Parent root = loader.load();
试试看
Parent root = FXMLLoader.load(getClass().getResource("nameOfFxml.fxml"));
login.fxml: 它是在Eclipse中使用JRE 1.8.0而不是IntelliJ思想 这是一个错误:
当运行我的Spring启动应用程序时,启动时低于异常。不确定是什么依赖导致了这一点。 Spring启动版本-2.3.1 IDE-Intellij 这是一个多模块maven项目。如果需要其他信息,请告诉我。 下面是我的父母pom.xml 4.0.0
我的代码中出现了这个错误。 这是我的代码: 这就是结果。错误:在线程“main”java中输入model:Exception。lang.NullPointerException在汽车上。主(车.java:10)
我从我的朋友那里收到了一个Java Web程序,我试图运行并理解代码,但我似乎无法运行它,以下是Apache日志中的错误消息 03-JUL-2014 20:33:51.873严重的[http-nio-8084-exec-29]org.apache.catalina.core.standardWrapperValve.invoke servlet.Service()在路径[/]上下文中的servle
试图使用Appium(Java)在android设备上自动化本机应用程序,但遇到了以下错误: 线程"main"中的异常java.lang.NoClassDefFoundError: org/openqa/selenium/远程/内部/JsonToWebElementConverter atwibu.main(wibu.java:21) 原因:java.lang.ClassNotFoundExcep
我刚开始我的大学java课程,在扫描器类中不断得到这个错误。 我不断得到的错误是: