You are not logged in.
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
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.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
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
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
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
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
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.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
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
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]:
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
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