Module javafx.base not found in java 13

715 views Asked by At

I have configured javafx 11 with openjdk 13. I have added the PATH_TO_FX statically to the location of javafx.

Image of PATH_TO_FX

And in project structure I have configured openjdk 13 but still it is giving the error Module javafx.base not found in java 11

enter image description here

1

There are 1 answers

0
Joop Eggen On BEST ANSWER

Every IDE can do maven or gradle projects. Search for maven repo openjfx and you'll find the (library) dependency to add. As one can expect many modules, jars, better use such a tool as maven. Search examples.

A pom.xml might contain the following OpenJFX dependencies. I have copied them for java 13, which you are using too.

<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>junaid.muhammad</groupId>
    <artifactId>myjavafx</artifactId>
    <version>1.0-SNAPSHOT</version>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>13</maven.compiler.source>
        <maven.compiler.target>13</maven.compiler.target>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-base</artifactId>
            <version>13.0.2</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>13.0.2</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-graphics</artifactId>
            <version>13.0.2</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-web</artifactId>
            <version>13.0.2</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>3.0.0-M5</version>
                <configuration>
                    <argLine>--illegal-access=permit</argLine>
                </configuration>
            </plugin>
            <plugin>
                <!-- Maybe the JavaFX plugin -->
                <groupId>org.openjfx</groupId>
                <artifactId>javafx-maven-plugin</artifactId>
                <version>0.0.4</version>
                <configuration>
                    <mainClass>.. MyApp</mainClass>
                </configuration>
            </plugin>    
        </plugins>
    </build>
</project>

I'll hope you see the advantage: there are several modules that make up JavaFX.