首页 > 解决方案 > Setting up JavaFX in IntelliJ - VM options not working at all

问题描述

I've been going through Stackoverflow answers for a while now, but none works. Basically I want to run JavaFX in intellij and created the basic JavaFX project. I'm using JDK/JavaFX 13.0.1. I added it under libraries as well. The path is C:\Program Files\Java\jdk-13.0.1\bin\java.exe

But when I try to set the VM-options, I get

Error: Could not find or load main class Files\\Java\\javafx-sdk-13.0.1\\lib
Caused by: java.lang.ClassNotFoundException: Files\\Java\\javafx-sdk-13.0.1\\lib

In the VM options I have --module-path %path% --add-modules javafx.controls,javafx.fxml

for %path%, I have tried everything I've seen on stackoverflow:

C:\\Program Files\\Java\\javafx-sdk-13.0.1\\lib
\C:\\Program Files\\Java\\javafx-sdk-13.0.1\\lib\
\C:\Program Files\Java\javafx-sdk-13.0.1\lib\
C:\Program Files\Java\javafx-sdk-13.0.1\lib
same with / instead of \. 

What the hell is going on, can someone please help me get it running?

标签: intellij-ideajavafx

解决方案


如果您在 VM 选项中引用的路径包含空格,则应使用双引号 ( ") 将其括起来:

-module-path "C:\Program Files\Java\javafx-sdk-13.0.1\lib"

推荐阅读