Y
Y
Yu Yu2019-04-04 21:16:46
linux
Yu Yu, 2019-04-04 21:16:46

Why is openjfx not included with openjdk?

Installed openjdk 12, but there is no javaFX. The program tells me to install oracle java or openjfx.
Installed oraclejdk 8. Everything is ok.
Did they not share something, or does openjfx have licensing problems?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2019-04-04
@xztau

There is a process of modularization of the standard library. So that in the future programmers can ship with the application a compact version of the virtual machine with the minimum required set of libraries. As part of this process, JavaFX was moved to a separate module. Just like for example JAXB - tools for working with XML and JSON. In one of the next versions, Swing will also be moved to a separate module. Until Java11, the JavaFX module remained part of the standard library and was included in OpenJDK, after which it was moved to a separate SDK. The required libraries can be obtained as dependencies:

Maven
<dependencies>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx.controls</artifactId>
        <version>12.0.0</version>
    </dependency>
</dependencies>
gradle
dependencies {
    compile 'org.openjfx:javafx.controls:12.0.0'
}

Or you can download the SDK here and connect the modules manually:
javac --module-path "C:\Program Files\Java\javafx-sdk-12\lib" --add-modules=javafx.controls Example.java
java --module-path "C:\Program Files\Java\javafx-sdk-12\lib" --add-modules=javafx.controls Example

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question