Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8210759

Swing interop fails when using a minimal jdk image created with jlink

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • jfx11
    • javafx

      To reproduce this:

      1. Download JDK 11

      2. Download or build the openjfx11 jmods

      3. Create a custom image using the following:

      $ jlink --module-path javafx-jmods-11 --add-modules java.desktop,javafx.swing,javafx.controls --output myjdk

      4. BUG: run the attached simple SwingNode application

      $ myjdk/bin/java SwingNodeApp

      InteropFactory: cannot load com.sun.javafx.embed.swing.newimpl.InteropFactoryN
      Exception in Application start method
      java.lang.reflect.InvocationTargetException
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:464)
      at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
      Caused by: java.lang.RuntimeException: Exception in Application start method
      at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)
      at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
      at java.base/java.lang.Thread.run(Thread.java:834)
      Caused by: 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 SwingNodeApp.start(SwingNodeApp.java:21)
      at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
      at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
      at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
      at java.base/java.security.AccessController.doPrivileged(Native Method)
      at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
      at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
      at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
      at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:277)
      ... 1 more
      Exception running application SwingNodeApp

            kcr Kevin Rushforth
            kcr Kevin Rushforth
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: