更新时间:2021-07-15 01:27:38
这对我有用:
文件 - >项目结构 - >模块 - >依赖选项卡
添加(+)你解压缩JavaFX的lib目录(对我来说,C: \Program Files\Java\javafx-sdk-11 \lib)。
范围是编译(这是默认值。)
然后你可以编辑它来称之为JavaFX双击该行。
File -> Project Structure -> Modules -> Dependency tab
add (+) the lib directory where you have unpacked JavaFX (for me, C:\Program Files\Java\javafx-sdk-11\lib).
Scope is Compile (which is the default.)
You can then edit this to call it JavaFX by double-clicking on the line.
然后在Run-> Edit Configurations - > VM Options中,输入:
--module-path =C:\\ \\ Program Files\Java \ javafx-sdk-11 \lib--add-modules = javafx.controls
then in Run->Edit Configurations -> VM Options, put: --module-path="C:\Program Files\Java\javafx-sdk-11\lib" --add-modules=javafx.controls
(哦,别忘了设置SDK)
(oh and don't forget to set the SDK)