title: LWJGL GLFW hangs on native glfwInit call
body: <p><em>I originally posted this question on <a href="https://gamedev.stackexchange.com/questions/185066/lwjgl-glfw-hangs-on-native-glfwinit-call">GameDev stackexchange</a> however I'll also ask the question here to try and get more outreach, especially since I wasn't sure my problem was specific to game development since it's a problem with a Java native call.</em></p>
  <p>For the past months I've been working on creating my own game engine <em>for personal use</em> in LWJGL using pieces here and there, especially from developer ThinMatrix's rightfully credited code, to learn as much as I can while building it. Only recently there has been strange behavior happening when I launch the engine from IntelliJ for testing:</p>
  <ul>
  <li><p>After about 6-10 individual times I click run, all subsequent runs suddenly take about 60 seconds for the window to appear.</p>
  </li>
  <li><p>Whenever I restart my PC this hanging resets and I have another 6-10 runs before it hangs everytime again.</p>
  </li>
  <li><p>I located the issue to <code>glfwInit</code>, more specifically at the call to the native method:</p>
  <pre><code>  @NativeType(&quot;int&quot;)
    public static boolean glfwInit() {
        long __functionAddress = Functions.Init;
        return invokeI(__functionAddress) != 0; // Right here
    }
  </code></pre>
  </li>
  <li><p>I also noticed that this issue only started when I attempted to implement text support in my engine using the STBTrueType library. It was perfectly fine before that. I tried removing the TrueType code but it didn't fix it.</p>
  </li>
  </ul>
  <p>Here's a list of things I've tried:</p>
  <ul>
  <li>Clearing my temp folder in case a buggy or corrupted file was present.</li>
  <li>Recompiling and rebuilding the entire LWJGL jars twice.</li>
  <li>Building <code>glfw.dll</code> from the GLFW sources and replacing the <code>glfw.dll</code> in the native jars with the former.</li>
  <li>Reinstalling Java and actually upgrading JDK versions (from 13.0.2 to 14.0.2)</li>
  <li>Switching IDEs even if I suspected it wouldn't work.</li>
  <li>Updating my NVIDIA drivers, and reinstalling them.</li>
  </ul>
  <p>I'm quite confused as to what it could be, and I'd be more than happy to share code, thread dumps, or debug info if you deem it necessary. <a href="https://github.com/KaiDuquet/OpenGLEngine" rel="nofollow noreferrer">Here is the Github repository</a> with the latest, &quot;faulty&quot; code (fault in quotes because I'm not too sure the code is the problem.)</p>
  <p>Thank you very much for any guidance.</p>
  <p>P.S: Please tell me if this is better asked in StackOverflow instead of here.</p>