I missed seeing the swing exception in your earlier message. Yes, the
Swing issue is a known problem in openjfx11, JDK-8210759 [1], and is
documented in the release notes [2].
It will be fixed in openjfx12 just as soon as I push the fix for
JDK-8210092 [3] later today (the review was just finished earlier this
morning). This was one of the bugs waiting until the fix requiring JDK
11 for openjfx 12 was pushed.
As for your other question, yes, if you add the javafx.* modules to your
Java runtime image, then that runtime image contains the javafx.*
modules. If your application were modularized, then the Java runtime
image would contain your application, too.
-- Kevin
[1] https://bugs.openjdk.java.net/browse/JDK-8210759
[2]
https://github.com/javafxports/openjdk-jfx/blob/jfx-11/doc-files/release-notes-11.md#known-issues
[3] https://bugs.openjdk.java.net/browse/JDK-8210092
On 9/27/2018 9:03 AM, Sverre Moe wrote:
Without the reliance on javafx-swing I was able to create an image,
package and execute my test application.
Is the Swing problem a known bug in JavaFX 11?
The jlink runtime image I reckon now also contains the JavaFX modules?
Seems unnecessary when they already are dependencies.
/Sverre
Den tor. 27. sep. 2018 kl. 10:42 skrev Sverre Moe
<sverre....@gmail.com <mailto:sverre....@gmail.com>>:
Den tor. 27. sep. 2018 kl. 00:49 skrev Kevin Rushforth
<kevin.rushfo...@oracle.com <mailto:kevin.rushfo...@oracle.com>>:
No, jlink won't link in a non-modular application. So the
steps are:
1) Run jlink to create a Java runtime image, possibly stripped
down, and
include the javafx.* modules you need
2) Run jpackager to package your non-modular application with
the above
Java runtime image.
-- Kevin
So we have to create the image with the jlink first before we use
jpackager, and we have to link in with the javafx modules. We
cannot use the javafx dependencies in the project?
jlink --add-modules=ALL-SYSTEM --output image
Error: Module ALL-SYSTEM not found
The just to make sure we have everything we need I add the actual
modules
jlink --add-modules=java.base --add-modules=java.desktop
--add-modules=java.net.http --add-modules=java.xml
--add-modules=java.prefs --add-modules=java.logging --output image
Linking in with the JavaFX jmods from Gluon:
jlink --add-modules=java.base --add-modules=java.desktop
--add-modules=java.net.http --add-modules=java.xml
--add-modules=java.prefs --add-modules=java.logging --module-path
/usr/java/javafx-jmods-11/ --add-modules=javafx.base
--add-modules=javafx.controls --add-modules=javafx.fxml
--add-modules=javafx.graphics --add-modules=javafx.web
--add-modules=javafx.media --add-modules=javafx.swing --output image
I managed to build our Java 8 project with Java 11, using the
JavaFX dependencies.
Then using jpackager with the runtime image from jlink
/usr/java/jpackager/jpackager create-installer --input
build/distributions/application-1.0.0-SNAPSHOT/lib/ --output
outputDir --runtime-image image/ --verbose --echo-mode --main-jar
application-1.0.0-SNAPSHOT.jar
Running the application image from jpackager
First try:
I thought I had added all necessary modules to the runtime image,
but I needed one more, java.management.
Second try:
InteropFactory: cannot load
com.sun.javafx.embed.swing.newimpl.InteropFactoryN
Exception in thread "GUIBuilderWorker"
java.lang.IllegalAccessError: class
com.sun.javafx.embed.swing.oldimpl.SwingNodeInteropO (in module
javafx.swing) cannot access class sun.swing.JLightweightFrame (in
module java.desktop) because module java.desktop does not export
sun.swing to module javafx.swing
at
javafx.swing/com.sun.javafx.embed.swing.oldimpl.SwingNodeInteropO.<clinit>(SwingNodeInteropO.java:71)
at
javafx.swing/com.sun.javafx.embed.swing.oldimpl.InteropFactoryO.createSwingNodeImpl(InteropFactoryO.java:42)
at
javafx.swing/javafx.embed.swing.SwingNode.<init>(SwingNode.java:271)
at
no.company.application.fx.MySwingComponent.initNode(MySwingComponent.java:155)
The module java.desktop should include the AWT/Swing.
At least I now have been able to create an native application
using both jlink and the new jpackager.
/Sverre