4

My application uses javafx 11.0.1 and is shipped bundled with a jlinked version of openjdk 11. It runs fine for the vast majority of the users but few of them are getting this stack:

Exception in thread "WindowsNativeRunloopThread" java.lang.NoSuchMethodError: <init>
        at com.sun.glass.ui.win.WinApplication.staticScreen_getScreens(Native Method)
        at com.sun.glass.ui.Screen.initScreens(Screen.java:412)
        at com.sun.glass.ui.Application.lambda$run$1(Application.java:152)
        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
        at java.base/java.lang.Thread.run(Unknown Source)
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
        at com.sun.javafx.tk.quantum.QuantumToolkit.assignScreensAdapters(QuantumToolkit.java:695)
        at com.sun.javafx.tk.quantum.QuantumToolkit.runToolkit(QuantumToolkit.java:313)
        at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$startup$10(QuantumToolkit.java:258)
        at com.sun.glass.ui.Application.lambda$run$1(Application.java:153)
        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
        at java.base/java.lang.Thread.run(Unknown Source)

I found some discussion related to the same exception but regarding Maven+Eclipse, here and here. The issue is very similar, user reporting it, do have other java installations and uninstalling them solves the issue, so basically leaving my bundled openjdk as the only option the application starts, but if there is another Java installed on the system, the wrong .dll is picked up and the application crashes with the above stacktrace.

I tried the suggested java.library.path workaround but users are saying it doesn't solve. Unfortunately I cannot reproduce it myself, any idea on how to solve it or what to ask the users reporting it?

EDIT: we fixed the exe generated by lauch4j here and the bash script here. The idea is basically to restrict/change the PATH env variable to avoid the wrong dll being picked up.

6
  • Can you clarify how do you run jlink and how do you set the runtime options? Mar 11, 2019 at 18:22
  • Have you tried updating to JDK 11.0.2? Mar 11, 2019 at 19:45
  • I haven't tried the latest openjdk or openjfx yet. I run jlink as shown here github.com/torakiki/pdfsam/blob/… in the jlink execution. You can run it with an exe generated by launch4j or using a batch "%JAVACMD%" -jar "%JAR_ARG%" %JAVA_OPTS% -Xmx512M -Dapp.name="pdfsam-basic" -Dprism.lcdtext=false -Dapp.home="%BASEDIR%" -Dbasedir="%BASEDIR%" org.pdfsam.basic.App %CMD_LINE_ARGS% as show here github.com/torakiki/pdfsam/blob/… Mar 11, 2019 at 20:37
  • The jlink tool creates platform-specific images. Are the users who are having problems using a different platform than the image was built for?
    – Slaw
    Mar 11, 2019 at 23:35
  • @Slaw No, they are using the Windows version. Uninstalling the Java 8 they have on the system fixes the issue and the application starts happily Mar 12, 2019 at 10:35

1 Answer 1

0

We fixed the exe generated by lauch4j here and the bash script here. The idea is basically to restrict/change the PATH env variable to avoid the wrong dll being picked up.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.