JRuby script with Rubeus and Swing exiting once packaged into jar using warble

后端 未结 2 1258
故里飘歌
故里飘歌 2021-01-15 06:00

I am trying to package a simple JRuby script into a jar file. The script uses Rubeus::Swing and runs correctly when executed with the JRuby interpreter.

相关标签:
2条回答
  • 2021-01-15 06:36

    Just set the appropriate flag:

    System.setProperty("warbler.skip_system_exit","true");
    
    0 讨论(0)
  • 2021-01-15 06:52

    Warbler calls System.exit() after your main script exits. This causes the Swing EventThread to exit, closing your app.

    https://github.com/jruby/warbler/blob/master/ext/JarMain.java#L131

    I worked around this problem by joining with the event thread at the bottom of my start script like so:

    event_thread = nil
    SwingUtilities.invokeAndWait { event_thread = java.lang.Thread.currentThread }
    event_thread.join
    

    Hacky, but it works.

    0 讨论(0)
提交回复
热议问题