FS#71510 - [java-openjfx] cannot be used by following the official documentation

Attached to Project: Arch Linux
Opened by ibbem (ibbem) - Wednesday, 14 July 2021, 20:37 GMT
Last edited by Toolybird (Toolybird) - Friday, 24 November 2023, 21:24 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Felix Yan (felixonmars)
Levente Polyak (anthraxx)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


The official JavaFX documentation
explains, that java needs the --module-path option to find the required modules for JavaFX.
But when using this option like this
$ java --module-path /usr/lib/jvm/java-16-openjdk/lib
the process exits with exit code 1 and prints the following error message:

Error occurred during initialization of boot layer
java.lang.LayerInstantiationException: Package jdk.internal.jimage.decompressor in both module java.base and module jrt.fs

When executing this command it doesn't matter whether java receives more options like the full command line given in the documentation:
$ java --module-path /usr/lib/jvm/java-16-openjdk/lib --add-modules javafx.controls HelloFX

I played a little bit with this and got it working by putting all JavaFX related files (except the licences of course) of the java-openjfx package into a separate folder like this:
$ mkdir /tmp/javafx
$ ln -s $(pacman -Ql java-openjfx | grep /usr/lib/jvm/java-16-openjdk/lib | tail +2) /tmp/javafx
$ java --module-path /tmp/javafx --add-modules javafx.controls HelloFX

Therefore I hypothesize that some file in that directory conflicts with some standard module.
I queried all the packages which installed files into that directory by executing
$ find /usr/lib/jvm/java-16-openjdk/lib -maxdepth 1 | xargs pacman -Qo | sed 's/.*owned by //' | cut -d ' ' -f 1 | sort | uniq
and got the following result:

Note: The offending file jrt.fs in the error message above is owned by jre-openjdk-headless which is a transitive dependency of java-openjfx.

Looking at the git log of the asp repository of java-openjfx, it seems like this directory structure is used since Java 11 is supported by javafx (git commit hash: 85bd803bbe46f37bb0a8a6d82316d3742ff26f15).
I did not yet verify if java-openjfx worked before this release, because I guess this change was due to the introduction of modules to java (and javafx).

If the java-openjfx package is intended to be used some other way, this is probably not a bug, but it should be documented in the arch wiki.
This could be done in a new wiki page for JavaFX or by adding to the existing paragraph in the
wiki page.

Hint: I think this bug was already reported by Mike (teacher4711) in  FS#65191 , but it was closed due to inactivity.

Package versions:
- java-openjfx 16.u8-1
- jdk-openjdk 16.0.1.u9-1
- jre-openjdk 16.0.1.u9-1
- jre-openjdk-headless 16.0.1.u9-1

Steps to reproduce:
# pacman -S jre-openjdk java-openjfx
$ java --module-path /usr/lib/jvm/java-16-openjdk/lib
This task depends upon

Closed by  Toolybird (Toolybird)
Friday, 24 November 2023, 21:24 GMT
Reason for closing:  Won't fix
Additional comments about closing:  Pkg dropped to the AUR
Comment by Arya (ImperatorStorm) - Saturday, 04 February 2023, 23:56 GMT
Potential duplicate of  FS#64121 
Comment by Buggy McBugFace (bugbot) - Tuesday, 08 August 2023, 19:11 GMT
This is an automated comment as this bug is open for more then 2 years. Please reply if you still experience this bug otherwise this issue will be closed after 1 month.