Issue
Issue
I am using AdoptOpenJDK's JRE 11* to run my application. This application uses JavaFX which needs JDK's system module called jdk.unsupported.desktop. This module is not present in mentioned JRE. I was wondering if it is possible to extract this single module from SDK and include it in non-modularized application.
*Adopt is releasing not only JDKs but also JREs
What I've tried
I've built custom JRE including missing module using jlink and it solved my problem. However, I would like to still use pre-built Adopt JRE instead of custom JRE which I need to create by myself.
Question
Is it possible to "extract" one module from JDK and use it in non-modularized application as an application module or regular "3rd party" jar?
Solution
I'm not aware of any "official" way to convert a platform module to a standalone JAR. But I believe you can just unzip the file jdk-11/jmods/jdk.unsupported.desktop.jmod
and repackage it into a JAR file.
- Copy
jdk-11/jmods/jdk.unsupported.desktop.jmod
to a temporary filejdk.unsupported.desktop.zip
- Unzip
jdk.unsupported.desktop.zip
- Zip the classes in the directory
jdk.unsupported.desktop/classes
tojdk.unsupported.desktop.jar
Now if you put jdk.unsupported.desktop.jar
to classpath, it should work with JRE 11.
Answered By - ZhekaKozlov
Answer Checked By - Terry (JavaFixing Volunteer)