更新时间:2022-06-22 00:46:50
您的问题不是编译项目,而是运行它.
由于main
是在Application
扩展名中定义的,因此运行项目将在启动时在模块路径中需要JavaFX.
Your problem is not compiling the project, but running it.
Since your main
is defined in your Application
-extension, running the project will require JavaFX in your module path on startup.
因此,要么将您的main
外包到与Application
不同的类中,要么添加带有VM参数的JavaFX模块:
So either outsource your main
into a class different from your Application
or add the JavaFX modules with VM arguments:
--module-path="<javafx-root>\lib" --add-modules="javafx.base,javafx.controls,..."
有关更多信息,请参见此.
See this for some more info.