4

I created JavaFX project in IntelliJ IDEA 2018. I have installed Java JDK 11 and my project (Maven) includes all needed dependencies:

<dependencies>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-controls</artifactId>
        <version>11</version>
    </dependency>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-fxml</artifactId>
        <version>11</version>
    </dependency>
</dependencies>

But when I try to launch app, I am getting:

    Error:(3, 26) java: cannot access javafx.application.Application
  bad class file: C:\Users\Baterka\.m2\repository\org\openjfx\javafx-graphics\11\javafx-graphics-11-win.jar(javafx/application/Application.class)
    class file has wrong version 54.0, should be 52.0
    Please remove or make sure it appears in the correct subdirectory of the classpath.

Where is problem? What are versions 54 and 52? Is JavaFX supported in new Java 11?

Baterka
  • 3,075
  • 5
  • 31
  • 60

2 Answers2

3

try adding this to your pom.xml file.

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.0</version>
            <configuration>
                <source>11.0.1</source>
                <target>11.0.1</target>
            </configuration>
        </plugin>
    </plugins>
</build>

It would be better if you update all your maven plugins also. see this youtube link, that's where I got the configuration.

-2

Just try to use JAVA 10, you just have to create new folder with that version, and you dont need to include any library. After that try to run it. and here's the link if you want to download it

https://www.oracle.com/java/technologies/java-archive-javase10-downloads.html

Lazy MdE
  • 61
  • 1
  • 2