0

I'm trying to run a JavaFX application in IntelliJ. Environment - Ubuntu 18.04. Java - 11.

But it gives me error saying :

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

Whole command in the run-console :

/usr/lib/jvm/java-1.11.0-openjdk-amd64/bin/java --module-path /home/mua/Software/javafx_sdk-1_3_1-b05a-linux-i586/javafx-sdk1.3/lib --add-modules=javafx.controls,javafx.fxml -Djava.library.path=/home/mua/Software/javafx_sdk-1_3_1-b05a-linux-i586/javafx-sdk1.3/lib -javaagent:/home/mua/Software/ideaIU-2020.3.1/idea-IU-203.6682.168/lib/idea_rt.jar=41593:/home/mua/Software/ideaIU-2020.3.1/idea-IU-203.6682.168/bin -Dfile.encoding=UTF-8 -classpath /home/mua/Desktop/PhotoSlide/PhotoSlide/target/classes:/home/mua/.m2/repository/org/openjfx/javafx-base/16-ea+7/javafx-base-16-ea+7.jar:/home/mua/.m2/repository/org/openjfx/javafx-base/16-ea+7/javafx-base-16-ea+7-linux.jar:/home/mua/.m2/repository/org/openjfx/javafx-fxml/16-ea+7/javafx-fxml-16-ea+7.jar:/home/mua/.m2/repository/org/openjfx/javafx-fxml/16-ea+7/javafx-fxml-16-ea+7-linux.jar:/home/mua/.m2/repository/org/openjfx/javafx-graphics/16-ea+7/javafx-graphics-16-ea+7.jar:/home/mua/.m2/repository/org/openjfx/javafx-graphics/16-ea+7/javafx-graphics-16-ea+7-linux.jar:/home/mua/.m2/repository/org/openjfx/javafx-media/16-ea+7/javafx-media-16-ea+7.jar:/home/mua/.m2/repository/org/openjfx/javafx-media/16-ea+7/javafx-media-16-ea+7-linux.jar:/home/mua/.m2/repository/org/openjfx/javafx-controls/16-ea+7/javafx-controls-16-ea+7.jar:/home/mua/.m2/repository/org/openjfx/javafx-controls/16-ea+7/javafx-controls-16-ea+7-linux.jar:/home/mua/.m2/repository/org/openjfx/javafx-swing/16-ea+7/javafx-swing-16-ea+7.jar:/home/mua/.m2/repository/org/openjfx/javafx-swing/16-ea+7/javafx-swing-16-ea+7-linux.jar:/home/mua/.m2/repository/org/controlsfx/controlsfx/11.0.2/controlsfx-11.0.2.jar:/home/mua/.m2/repository/org/kordamp/ikonli/ikonli-core/12.1.0/ikonli-core-12.1.0.jar:/home/mua/.m2/repository/org/kordamp/ikonli/ikonli-javafx/12.1.0/ikonli-javafx-12.1.0.jar:/home/mua/.m2/repository/org/kordamp/ikonli/ikonli-themify-pack/12.1.0/ikonli-themify-pack-12.1.0.jar:/home/mua/.m2/repository/org/kordamp/ikonli/ikonli-fontawesome-pack/12.1.0/ikonli-fontawesome-pack-12.1.0.jar:/home/mua/.m2/repository/com/github/dragon66/icafe/1.1-SNAPSHOT/icafe-1.1-20190902.150913-102.jar:/home/mua/.m2/repository/com/github/jai-imageio/jai-imageio-core/1.4.0/jai-imageio-core-1.4.0.jar:/home/mua/.m2/repository/com/twelvemonkeys/imageio/imageio-core/3.6/imageio-core-3.6.jar:/home/mua/.m2/repository/com/twelvemonkeys/common/common-lang/3.6/common-lang-3.6.jar:/home/mua/.m2/repository/com/twelvemonkeys/common/common-io/3.6/common-io-3.6.jar:/home/mua/.m2/repository/com/twelvemonkeys/common/common-image/3.6/common-image-3.6.jar:/home/mua/.m2/repository/com/twelvemonkeys/imageio/imageio-tiff/3.6/imageio-tiff-3.6.jar:/home/mua/.m2/repository/com/twelvemonkeys/imageio/imageio-psd/3.6/imageio-psd-3.6.jar:/home/mua/.m2/repository/com/twelvemonkeys/imageio/imageio-metadata/3.6/imageio-metadata-3.6.jar:/home/mua/.m2/repository/org/slf4j/slf4j-simple/2.0.0-alpha1/slf4j-simple-2.0.0-alpha1.jar:/home/mua/.m2/repository/org/slf4j/slf4j-api/2.0.0-alpha1/slf4j-api-2.0.0-alpha1.jar:/home/mua/.m2/repository/com/h2database/h2/1.4.200/h2-1.4.200.jar:/home/mua/.m2/repository/org/ejml/ejml-simple/0.40/ejml-simple-0.40.jar:/home/mua/.m2/repository/org/ejml/ejml-core/0.40/ejml-core-0.40.jar:/home/mua/.m2/repository/javax/media/jai/com.springsource.javax.media.jai.core/1.1.3/com.springsource.javax.media.jai.core-1.1.3.jar:/home/mua/.m2/repository/org/projectlombok/lombok/1.18.16/lombok-1.18.16.jar:/home/mua/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.12.0/jackson-databind-2.12.0.jar:/home/mua/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.12.0/jackson-annotations-2.12.0.jar:/home/mua/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.12.0/jackson-core-2.12.0.jar org.photoslide.App

And I've added the VM with :

--module-path /home/mua/Software/javafx_sdk-1_3_1-b05a-linux-i586/javafx-sdk1.3/lib --add-modules=javafx.controls,javafx.fxml

And added libraries too :

java.lang.module.FindException: Module javafx.controls not found

Source code : https://github.com/maifeeulasad/PhotoSlide

Java configurations :

>>java --version
openjdk 11.0.10 2021-01-19
OpenJDK Runtime Environment (build 11.0.10+9-Ubuntu-0ubuntu1.18.04)
OpenJDK 64-Bit Server VM (build 11.0.10+9-Ubuntu-0ubuntu1.18.04, mixed mode, sharing)
>>javac --version
javac 11.0.10  
Maifee Ul Asad
  • 3,992
  • 6
  • 38
  • 86
  • Try to use the JDK version matched with your OpenJFX library version. JDK 11 with OpenJFX 11. – ישו אוהב אותך Feb 19 '21 at 19:24
  • @ישואוהבאותך i'm using java11, i've added them at bottom of the question now, please check – Maifee Ul Asad Feb 19 '21 at 19:36
  • @ישואוהבאותך That's not the issue (I'm running OpenJDK 15 + OpenJFX 11 - But I did read somewhere there was an issue when using OpenJDK 14 + OpenJFX 14). Anyway, OP, which option did you choose from [here](https://openjfx.io/openjfx-docs/)? I had similar BS problems couple of days ago when I tried the "Modular from IDE" - when the solution I found wasn't satisfactory to me, I went with Maven (I see you did that), but I think it was missing something that I need (not sure), so I went with Gradle. There was a little BS there as well, but I managed to set it up properly. – Doombringer Feb 20 '21 at 04:34
  • **I've Java Installed** -> **export PATH_TO_FX=path/to/javafx-sdk-15.0.1/lib** then went to intellij and edited libraries and vm options.. @DoombringerBG – Maifee Ul Asad Feb 20 '21 at 07:58
  • What are the contents of your `pom.xml` file? – Doombringer Feb 20 '21 at 18:03
  • @DoombringerBG here is the [pom.xml](https://github.com/maifeeulasad/PhotoSlide/blob/master/PhotoSlide/pom.xml) – Maifee Ul Asad Feb 21 '21 at 05:38

1 Answers1

0

From what I understand, you're using Non-modular with Maven.

I built one from scratch myself following the instructions provided in the link above and noticed the picture marked in yellow.

There are 2 Environment Virables that need to be set for the OpenJDK. One in your system (e.g. ./bashrc file) and one in IntelliJ for Maven (in case you're using Java 11 or above, which you are in this case).

As per your post, I know you have the one in your system, but it doesn't mention the one in this picture, so make sure you do.

Also, notice I haven't set up any VM options!

The link above states:

The JavaFX classes will be recognized. Notice also that Maven manages the required dependencies: it will add javafx.base and javafx.graphics that are required by javafx.controls and javafx.fxml, but most important, it will add the required classifier based on your platform, downloading the specific platform jars.

OpenJDK ENV in Maven

This is my pom.xml file (auto-generated by IntelliJ when making the project):

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.company</groupId>
    <artifactId>testing_maven</artifactId>
    <version>1.0</version>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>11.0.2</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-fxml</artifactId>
            <version>11.0.2</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <release>11</release>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.openjfx</groupId>
                <artifactId>javafx-maven-plugin</artifactId>
                <version>0.0.4</version>
                <configuration>
                    <mainClass>com.company.App</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

I strongly recommend looking through the link I posted. You might've missed something. If not, then definitely try and create a new testing project, follow the instructions and see if it works. If it does, compare things to your current project.

Sorry, I couldn't have been of more help. I don't really work with Maven.

Doombringer
  • 596
  • 4
  • 19