且构网

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

错误:缺少 JavaFX 运行时组件,需要使用 JDK 11 运行此应用程序

更新时间:2021-09-28 01:17:37

这对我有用:

文件>>项目结构>>模块>>依赖>>+(在窗口左侧)

File >> Project Structure >> Modules >> Dependency >> + (on left-side of window)

点击+"号会让你指定解压JavaFX的lib"文件夹的目录.

clicking the "+" sign will let you designate the directory where you have unpacked JavaFX's "lib" folder.

Scope 是 Compile(这是默认值.)然后,您可以通过双击该行来编辑它以将其称为 JavaFX.

Scope is Compile (which is the default.) You can then edit this to call it JavaFX by double-clicking on the line.

然后在:

运行>>编辑配置

将此行添加到 VM 选项:

Add this line to VM Options:

--module-path /path/to/JavaFX/lib --add-modules=javafx.controls

(哦,别忘了设置SDK)

(oh and don't forget to set the SDK)