Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java FX Modular Application, Module not found (Java 11, Intellij)

Hello I have a problem with my modular Java FX Application.

First of all I created a JavaFX Project with the Intellij Wizard.
I added the Java FX lib:

Project Strucutre with JavaFX lib

And the JavaFX modules get recognized. My module-info.java:

module-info

I also added the VM options:

VM Options and Config

But I always get this errormessage:

Errormessage

"Error occured during initialization of boot layer
java.lang.module.FindException: Module HelloFX not found"

Thank you.

like image 553
No110 Avatar asked Nov 23 '18 13:11

No110


People also ask

Why JavaFX is not working in IntelliJ?

To be able to work with JavaFX in IntelliJ IDEA, the JavaFX bundled plugin must be enabled: In the Settings/Preferences dialog ( Ctrl+Alt+S ), select Plugins. Switch to the Installed tab and make sure that the JavaFX plugin is enabled. If the plugin is disabled, select the checkbox next to it.

How do I add JavaFX to IntelliJ project?

Click on the File menu and select Project Structure . In the dialog that appears, select the Libraries tab and click the + icon to add a new Java library: Find your javafx-sdk folder and select the lib subfolder: Click the OK button to complete the process.


1 Answers

When you get the error:

Error occurred during initialization of boot layer

java.lang.module.FindException: Module HelloFX not found

it means that the path to the module in question in --module-path is wrong and the module can't be found.

Check the output folder. Based on your first picture, the output of the HelloFX project goes to out, but your VM options you are setting the relative path to mods.

You can configure the compiler output from IntelliJ -> File -> Project Structure -> Project -> Project Compile Output.

On Windows by default, when you create a JavaFX project, IntelliJ points to \path-to\HelloFX\out.

Then you either modify that compile output path to \path-to\HelloFX\mods, or your VM arguments:

--module-path "\path-to\javafx-sdk-11.0.1\lib;out\production" 
like image 200
José Pereda Avatar answered Sep 28 '22 03:09

José Pereda