You are not logged in.

#1 2019-09-06 17:46:12

Xakep_SDK
Member
Registered: 2017-09-23
Posts: 61

OpenJFX 12 does not work on OpenJDK 12

I have OpenJDK 12 JDK installed and OpenJFX for java 12
JavaFX is not in classpath and/or module path, i can't start any javafx apps on java 12 without manually adding javafx jars from maven central repository.(e.g. start via java -cp javafx_jars/*:app.jar Main)

Last edited by Xakep_SDK (2019-09-07 20:50:21)

Offline

#2 2019-09-07 12:04:02

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,911

Re: OpenJFX 12 does not work on OpenJDK 12

openjfx libs/modules are installed at the same place as openjdk libs/modules .
Maybe your default java is not set up correctly or points to another java version then 12.

post output of

$ archlinux-java status

Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#3 2019-09-07 13:12:48

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,645

Re: OpenJFX 12 does not work on OpenJDK 12

Please edit your thread title and change it to one that actually describes your issue: https://wiki.archlinux.org/index.php/Co … ow_to_post

Offline

#4 2019-09-07 20:52:09

Xakep_SDK
Member
Registered: 2017-09-23
Posts: 61

Re: OpenJFX 12 does not work on OpenJDK 12

Lone_Wolf wrote:

openjfx libs/modules are installed at the same place as openjdk libs/modules .
Maybe your default java is not set up correctly or points to another java version then 12.

post output of

$ archlinux-java status

Here:
user@arch ~ % java -version                     
openjdk version "12.0.2" 2019-07-16
OpenJDK Runtime Environment (build 12.0.2+10)
OpenJDK 64-Bit Server VM (build 12.0.2+10, mixed mode)

user@arch ~ % archlinux-java status
Available Java environments:
  java-12-openjdk (default)
  java-8-openjdk

user@arch ~ % pacman -Qn | grep openjfx
java-openjfx 12.0.2.u1-1
java-openjfx-doc 12.0.2.u1-1
java-openjfx-src 12.0.2.u1-1
java8-openjfx 8.u202-3
java8-openjfx-doc 8.u202-3
java8-openjfx-src 8.u202-3

Last edited by Xakep_SDK (2019-09-07 20:52:26)

Offline

#5 2019-09-08 00:36:06

progandy
Member
Registered: 2012-05-17
Posts: 5,190

Re: OpenJFX 12 does not work on OpenJDK 12

For some reason the package for openjfx 12.0.2.u1-2 (in testing) installs the files to usr/lib/jvm/java-12-openjfx/ instead of usr/lib/jvm/java-12-openjdk/. The first pkrel 12.0.2.u1-1 did install to the openjdk location. Does this new version fix it for you? I don't know why the location had to be changed with java 12. This looks strange to me, though. How would java find the path to openjfx? Is that hardcoded somewhere?

Last edited by progandy (2019-09-08 00:46:40)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#6 2019-09-08 18:23:26

Xakep_SDK
Member
Registered: 2017-09-23
Posts: 61

Re: OpenJFX 12 does not work on OpenJDK 12

Testing does not work

user@arch /etc/pacman.d % pacman -Qn | grep openjfx
java-openjfx 12.0.2.u1-2
java-openjfx-doc 12.0.2.u1-1
java-openjfx-src 12.0.2.u1-1
java8-openjfx 8.u202-3
java8-openjfx-doc 8.u202-3
java8-openjfx-src 8.u202-3

Offline

#7 2019-09-09 10:24:00

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,911

Re: OpenJFX 12 does not work on OpenJDK 12

JavaFX is not in classpath and/or module path, i can't start any javafx apps on java 12 without manually adding javafx jars from maven central repository.(e.g. start via java -cp javafx_jars/*:app.jar Main)

What command would you use to start such apps, and what was the terminal output of it ?
Could you provide us with an example we can test ourselves ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#8 2019-09-09 14:25:09

Xakep_SDK
Member
Registered: 2017-09-23
Posts: 61

Re: OpenJFX 12 does not work on OpenJDK 12

https://gitlab.com/Xakep_SDK/testfx
Compile it with java 8 + javafx and try to run with java 12 + javafx

Error:
Fehler: Hauptklasse dk.xakeps.testfx.App konnte nicht gefunden oder geladen werden
Ursache: java.lang.NoClassDefFoundError: javafx/application/Application

It can't load app because javafx class was not found.

Last edited by Xakep_SDK (2019-09-09 14:25:40)

Offline

#9 2019-09-10 01:26:10

twelveeighty
Member
From: Alberta, Canada
Registered: 2011-09-04
Posts: 1,096

Re: OpenJFX 12 does not work on OpenJDK 12

We have a couple of different problems happening at the same time here.

First: OP's original issue is because you are not following the proper instructions for JFX 12 (see https://openjfx.io/openjfx-docs/#install-javafx). Your must both compile and run against JDK 12 and use the --module-path and --add-modules parameters since the introduction of modules (Project JigSaw) in JDK 9. I tested that with your code and it compiles and "runs".

However, then you'll run into a 2nd problem, which is fixed with java-openjfx 12.0.2.u1-2 in [testing]:

progandy wrote:

For some reason the package for openjfx 12.0.2.u1-2 (in testing) installs the files to usr/lib/jvm/java-12-openjfx/ instead of usr/lib/jvm/java-12-openjdk/.

The reason is that unless this is done, you'll get the following error trying to execute your class:

$ /usr/lib/jvm/java-12-openjdk/bin/java --module-path /usr/lib/jvm/java-12-openjdk/lib --add-modules javafx.controls,javafx.fxml -cp ./build/TestApp.jar dk.xakeps.testfx.App
Error occurred during initialization of boot layer
java.lang.LayerInstantiationException: Package jdk.internal.jimage.decompressor in both module java.base and module jrt.fs

This error is because jdk.internal.jimage.decompressor is defined in both java.base and jrt.fs and since the current [extra] package bundles all modules into a single folder, the runtime finds both. I don't have [testing] enabled, so I haven't tested it, but my guess is that with the separation of /usr/lib/jvm/java-12-openjfx and /usr/lib/jvm/java-12-openjdk this last problem will go away as well.

Last edited by twelveeighty (2019-09-10 01:30:17)

Offline

#10 2019-09-10 14:34:12

Xakep_SDK
Member
Registered: 2017-09-23
Posts: 61

Re: OpenJFX 12 does not work on OpenJDK 12

I made some investigation.
Java 8 and JavaFX 8 compiled apps shall work on Java 12 and JavaFX 12, unless they use some internal api.
JavaFX app compiled with java 8 will not start with on java 12 + javafx 12 only if this app uses javafx loader. (e.g. java will search for JavaFX entry point, not java entry point)
See updated version of test app on gitlab with java entry point, not javafx entry point.

To launch app with javafx 12 on java 12:
1. Download JavaFX 12 jars from maven
https://repo1.maven.org/maven2/org/open … -linux.jar
https://repo1.maven.org/maven2/org/open … -linux.jar
https://repo1.maven.org/maven2/org/open … -linux.jar
2. Add them to classpath
3. Launch app
E.g.
put downloaded jars in libs directory, then launch app via this command:
java -cp testfx-1.0-SNAPSHOT.jar:libs/\* dk.xakeps.testfx.Main

Launching app with this command
java -jar testfx-1.0-SNAPSHOT.jar
gives this error
Exception in thread "main" java.lang.NoClassDefFoundError: javafx/application/Application
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
        at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:802)
        at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:700)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:623)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        at dk.xakeps.testfx.Main.main(Main.java:7)
Caused by: java.lang.ClassNotFoundException: javafx.application.Application
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        ... 10 more

Test results:
Java 12 + OpenJFX 12.0.2.u1-2 [test repo]
1. Manually provided JavaFX via -cp argument
works
2. java -jar app.jar
not working [big exception above]

Same results for current OpenJFX version: 12.0.2.u1-1

With current openjfx [i did not test this with version from test repo]
3. java -cp testfx-1.0-SNAPSHOT.jar:/usr/lib/jvm/java-12-openjdk/lib/\* dk.xakeps.testfx.Main
works

Looks like JavaFX is not in classpath.

What i didn't test:
Compiling test app as modularized application and running with Java 12 and JavaFX 12

Offline

Board footer

Powered by FluxBB