2

MY SETUP:

I followed the steps for the JavaFX and IntelliJ -> Modular from IDE path.

I added the ikonli-core-12.2.0.jar, ikonli-javafx-12.2.0.jar and ikonli-carbonicons-pack-12.2.0.jar via the repository to the Scene Builder in this order. Here, they work fine.

Then I added those same .jars in that same order to the IntelliJ as described here: Correct way to add external jars (lib/*.jar) to an IntelliJ IDEA project.

My module-info.java file contains the following code:

module project {

    requires javafx.controls;
    requires javafx.fxml;

    requires org.kordamp.ikonli.core;
    requires org.kordamp.ikonli.javafx;
    requires org.kordamp.ikonli.carbonicons;

    opens com.project to javafx.fxml;

    exports com.project;
}

Picture of my libraries:

Libraries

PROBLEM:

When I add an icon to the .fxml file and I click on Run, I get the following error:

Error occurred during initialization of boot layer
java.lang.module.FindException: Module org.kordamp.ikonli.javafx not found, required by project

The module name varies. Sometimes it says it's the javafx, others the core or the carbonicons.

I'm not sure why this happens. When I'm typing in the module-info.java file I get the autofill prompts, , but when I try, for example, import org.kordamp.ikonli.core; in my Main.java, it doesn't detect them.

I'm not sure why this happens. When I'm typing in the module-info.java file or try import org.kordamp.ikonli.javafx.FontIcon; in my Main.java, I get the autofill prompts, so it means it's detecting them.

If I remove the "ikonli requires" from the module-info.java and run it, I get this error (which is kind of understandable):

java.lang.ClassNotFoundException: org.kordamp.ikonli.javafx.FontIcon

SOLUTIONS I'VE TRIED:

  1. Adding the .jars via File -> Project Settings -> Libraries.

This seems to automatically add them to the Modules -> Dependencies, but even so, the problem persists.

  1. Adding them in the VM Options (Run -> Edit Configuration -> Modify Options -> VM Options) in various ways, right after the --module-path ${PATH_TO_FX}:out/production mentioned in the steps linked above (out can be safely changed to mods but I chose not to do that).

First:

--module-path ${PATH_TO_IKONLI_CORE}, --module-path ${PATH_TO_IKONLI_JAVAFX} and --module-path ${PATH_TO_IKONLI_CARBONICONS}

Doing this makes it so my actual project module doesn't get detected. I.E. I get this error:

Error occurred during initialization of boot layer
java.lang.module.FindException: Module project not found

Second:

--add-modules ${PATH_TO_IKONLI_CORE},${PATH_TO_IKONLI_JAVAFX},${PATH_TO_IKONLI_CARBONICONS}

This one produces a smiliar error:

Error occurred during initialization of boot layer
java.lang.module.FindException: Module /directory/path/to/file/ikonli-core-12.2.0.jar not found

Third:

--add-modules org.kordamp.ikonli.core,org.kordamp.ikonli.javafx,org.kordamp.ikonli.carbonicons

A similar error shows up:

Error occurred during initialization of boot layer
java.lang.module.FindException: Module org.kordamp.ikonli.core not found
  1. I tried File -> Reload all from disk and Invalidate Caches / Restart options, but they seem to have had no effect.

  2. I created a lib folder in my src project folder, put the .jars there and added them as dependencies. Now they didn't show up in the External Libraries section (because they're not external obviously) but the problem remains (I'll re-add them as external again).

ADDITIONAL INFORMATION:

I've added controlsfx.jar the same way as the Ikonli .jars. The same error occurs for it as well.

They all have their module-info.class file in the proper directory as stated in the official javadoc, yet the ModuleFinder still throws the exception.

I've also checked my project.iml file and they all have the module-libraries with the correct directories present.

I've revisted the official Ikonli installation steps multiple times and everything checks out.

Though, in there it mentions that I need to have requires javafx.base; requires javafx.graphics; in the module descriptor. Not true, at least in my case, because when I add --show-module-resolution to the VM Options, it shows that they're loaded fine, but even when I do add them, the error still appears.

END

Sorry for the long post, I'm out of ideas and I don't know what else to try.

Doombringer
  • 596
  • 4
  • 19

1 Answers1

0

One of the comments here mentioned that they'd put their .jar in the mods/production folder. I did the same... and it worked. (╯°□°)╯︵ ┻━┻

bruh

I guess "Modular from IDE" doesn't agree with the IDE.

Looks like the proper way to go about modular is to use Maven/Gradle. I'll rebuild and go with Gradle.

Doombringer
  • 596
  • 4
  • 19