4

I've been browsing Stack overflow and googling my way through this for the past 3 hours, and nothing seems to be helping.

My Project Structure settings are as follows:

Project SDK: "11 (java version "11.0.2") 

Project language level: "11 - Local variable syntax for lambda parameters" - I have also tried the SDK default

Under Modules I have imported all javafx-sdk-11.0.2 jar files

And my VM options:

--module-path C:\Program Files\Java\OpenJDK\javafx-sdk-11.0.2\lib --add-modules=javafx.controls,javafx.fxml 

Now, whenever I try to run an Application, I get the following error:

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

EDIT:

I added the path into quotation marks, that in turn moved on to the next error: "Error occurred during initialization of boot layer java.lang.module.FindException: Module javafx.base not found"

4
  • 2
    quote your module-path - --module-path "C:\Program Files\Java\OpenJDK\javafx-sdk-11.0.2\lib" Commented Mar 16, 2019 at 23:51
  • Now I get "java.lang.module.FindException: Module javafx.base not found" Commented Mar 16, 2019 at 23:55
  • Probably ought to try adding that one to your --add-modules list. The first error was caused by the space in your module-path. Commented Mar 16, 2019 at 23:57
  • It remains the same, once added to --add-modules. Also I can see that file in my javafx sdk folder. Commented Mar 17, 2019 at 0:01

3 Answers 3

2

It seems that I got it fixed by using the following VM options: --module-path ${PATH_TO_FX} --add-modules=javafx.controls,javafx.fxml,javafx.base

And I also tried adding individual jar files to my modules, which seemed to have worked.

Sign up to request clarification or add additional context in comments.

Comments

1

With IJ, Click Run Choose Edit Configurations In the VM Options Enter --module-path "C:\Program Files\Java\OpenJDK\javafx-sdk-11.0.2\lib" --add-modules=javafx.controls,javafx.fxml

Or --module-path "here insert your path" --add-modules=javafx.controls,javafx.fxml

Comments

0

I ran into the same problem.

Apparently I was using JavaFX 11.0.2 with a JDK that was in /Applications/IntelliJ IDEA.app/Contents/jbr/Contents/Home which showed up in the Project Settings as 11.0.6. I switched to Adopt OpenJDK 11 and the problem was resolved.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.