【发布时间】:2021-10-13 14:41:47
【问题描述】:
我一直在尝试使用 JavaFX 16 设置我的 NetBeans 12.4,但它无法正常工作。到目前为止,我已经按照我遇到的关于如何解决它的教程进行操作,但到目前为止还没有成功。我添加了一个包含 8 个 javafx .jar 文件的全局库,并从路径文件夹中删除了 src.zip 文件和 javafx.properties 文件,并将文件路径添加到 VM 选项中,但它仍然抛出错误。
这是我抛出错误的简单程序
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package javaprojectfx;
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.HBox;
import javafx.scene.control.Label;
/**
*
* @author
*/
public class JavaProjectFX extends Application
{
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
launch(args);
}
@Override
public void start(Stage primaryStage)
{
Label messageLabel = new Label("Hello World");
HBox hbox = new HBox(messageLabel);
Scene scene = new Scene(hbox);
primaryStage.setScene(scene);
primaryStage.setTitle("My First GUI Application");
primaryStage.show();
}
}
这是它给我的错误
run:
Error occurred during initialization of boot layer
java.lang.module.FindException: Module javafx.base not found
C:\Users\treyh\AppData\Local\NetBeans\Cache\12.4\executor-snippets\run.xml:111: The following error occurred while executing this line:
C:\Users\treyh\AppData\Local\NetBeans\Cache\12.4\executor-snippets\run.xml:68: Java returned: 1
BUILD FAILED (total time: 0 seconds)
这是我在虚拟机选项区域中输入的内容,以防我写错了
--module-path "C:\Program Files\Java\javafx-sdk-16\lib" --add-modules=javafx.base,javafx.controls,javafx.fxml,javafx.graphics【问题讨论】: