0

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

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
  • You need OpenJFX. I often use a project based on the **maven** build infrastructure, with library dependency management. – Joop Eggen Sep 17 '20 at 07:28
  • How will I get that – Muhammad Junaid Khalid Sep 17 '20 at 08:07
  • 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. I'll give a pom.xml (maven's project-object-module). – Joop Eggen Sep 17 '20 at 08:12
  • This is not directly related to your problem but why do you use such a weired combination of versions. It just doesn't make sense to use an old version of JavaFX with a younger but still not current version of Java. Why don't you just use Java15/JavaFX15? – mipa Sep 17 '20 at 08:15

1 Answers1

2

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.

Joop Eggen
  • 107,315
  • 7
  • 83
  • 138