jnigi icon indicating copy to clipboard operation
jnigi copied to clipboard

macOS AWT/Swing support

Open mlaggner opened this issue 2 years ago • 0 comments

I am just trying to use this lib in my golang launcher for my Java Swing application. I managed to start up the JVM and load the first few lines of code before the EventDispatchThread starts. My Java program looks like

public static void main(String[] args) {
  // do something before EDT
  EventQueue.invokeLater(new Runnable() {
    public void run() {
      // start the UI-application
    }
  }
}

In the logs of the application I just see the lines before the EDT start but afterwards nothing happens and the launcher is just "hung".

I found the issues #35 and the PR #36 and #43 but I did not find the right solution for the problem. According to the example of OpenJDK (https://github.com/AdoptOpenJDK/openjdk-jdk/blob/master/src/java.base/macosx/native/libjli/java_md_macosx.m#L354) I see that we need to rund main in a new thread and "park" the first thread - OpenJDK uses CoreFoundation here...

Is this still needed for using this lib? Why has the corresponding code been removed from PR #43?

I have a full setup to help here, but my knowledge with CGO is very limited (I am a Java developer :) ).

mlaggner avatar Oct 08 '22 06:10 mlaggner