我正在使用 IntelliJ IDEA 2016.3.3 生成的未更改的示例应用程序。当我尝试运行它时,它显示“进程已完成,退出代码 -1073740791 (0xC0000409)” 然而,当我在 Eclipse 中运行完全相同的源代码时,一切都正常。 P.S:我正在使用 IntelliJ ID 中的默认设置。
Main.java:
package sample;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage primaryStage) throws Exception{
Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
primaryStage.setTitle("Hello World");
primaryStage.setScene(new Scene(root, 300, 275));
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
示例.fxml
<?import javafx.geometry.Insets?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<GridPane fx:controller="sample.Controller"
xmlns:fx="http://javafx.com/fxml" alignment="center" hgap="10" vgap="10">
</GridPane>
Controller .java
package sample;
public class Controller {
}
更新:我通过在笔记本电脑上停用 nVidia 卡解决了这个问题。
最佳答案
此错误通常与 nVidia 图形驱动程序有关。我可以确认这是由于 2017 年 1 月 24 日更新所致。 Roll back to December 2016 update for now until they fix this issue.
关于JavaFX 应用程序无法在 IntelliJ Idea 下运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41898966/