JDK-8231015 : Exception in thread ���WindowsNativeRunloopThread��� java.lang.NoSuchMethodError
  • Type: Bug
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: openjfx11
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • OS: windows_10
  • CPU: x86_64
  • Submitted: 2019-09-13
  • Updated: 2019-09-14
  • Resolved: 2019-09-14
Description
ADDITIONAL SYSTEM INFORMATION :
Windows 10,  jlinked AdoptOpenJDK 1.0.4 bundled within the application.

A DESCRIPTION OF THE PROBLEM :
My application uses javafx 11.0.4 and is shipped bundled with a jlinked version of AdoptOpenJDK 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.prism.d3d.D3DPipeline.getAdapterOrdinal(D3DPipeline.java:205)
        at com.sun.javafx.tk.quantum.QuantumToolkit.assignScreensAdapters(QuantumToolkit.java:738)
        at com.sun.javafx.tk.quantum.QuantumToolkit.runToolkit(QuantumToolkit.java:334)
        at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$startup$10(QuantumToolkit.java:279)
        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)
Exception in thread "Glass/Prism Shutdown Hook" java.lang.NullPointerException
        at com.sun.javafx.tk.quantum.QuantumToolkit.dispose(QuantumToolkit.java:841)
        at com.sun.javafx.tk.quantum.QuantumToolkit$1.run(QuantumToolkit.java:252)

The issue happens if the user has other jdk installed (ex. openjdk 8) and it seems the bundled jdk 11 is picking up some wrong .dll. 
I found some discussion related to the same exception but regarding Maven+Eclipse, https://www.mail-archive.com/openjfx-dev@openjdk.java.net/msg14667.html and https://stackoverflow.com/questions/52906570/javafx-11-using-maven-throws-exception-windowsnativerunloopthread. The issue is very similar, the user reporting it has other java installations and uninstalling them solves the issue, so basically leaving my bundled jdk 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. 

Here  https://github.com/torakiki/pdfsam/issues/357 a user investigate the issue and found that tweaking with the PATH env variable fixed the issue.
I also tried to get help from StackOverflow without success so far https://stackoverflow.com/questions/55107931/any-idea-how-to-fix-this-exception-in-thread-windowsnativerunloopthread-java


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
It happens to some users with some other JDK installed. I cannot reproduce it myself.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The application runs
ACTUAL -
Very few users get a: Exception in thread "WindowsNativeRunloopThread" java.lang.NoSuchMethodError: <i
nit>
        at com.sun.glass.ui.win.WinApplication.staticScreen_getScreens(Native Me
thod)

CUSTOMER SUBMITTED WORKAROUND :
Uninstall other JDKs in the system.  It seems removing the jdk 8 from the PATH env variable solves this. 


Comments
This is caused by a configuration error on the developers machine. Closing as "Not an issue".
14-09-2019