且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

错误:缺少JavaFX运行时组件-JavaFX 11和OpenJDK 11和Eclipse IDE

更新时间: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.