Environment:
- OS: For developing and running the application, both Windows 10 Pro (1809) and Linux (something like Ubuntu or Debian) with OpenJDK 1.8 and Maven installed will be used.
- JDK: OpenJDK 1.8
- IDE: IntelliJ Ultimate
- Build tool Maven (multi-module project, one module uses JavaFX)
- I'd very much prefer not to use anything with a paid license (even though, for this project, I could probably use the Oracle JDK for free...).
The problem:
I know, that the JDK 1.8 is supposed to come with JavaFX included. However, for OpenJDK 1.8 this, somehow, seems not to be the case (without the Maven dependencies, IntelliJ doesn't accept import javafx.application.Application;
nor any other JFX imports).
For this reason, I am trying to include it as a Maven dependency. If I use:
<!-- JavaFX -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11</version>
</dependency>
.
.
.
I get the following error message:
Error:(3, 26) java: cannot access javafx.application.Application
bad class file: /C:/Users/kaspa/.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.
Using <version>12</version>
yields [...]wrong version 55.0, should be 52.0[...]
.
The lowest <version>
, inside the Maven <dependency>
, I am able to use seems to bo 11.
The Question:
- Is there something I can add/change to my
pom.xml
to make my application compile and run? - Do I absolutely need to upgrade to OpenJDK 11 or 12?