Hello Guest

LWJGL3 Stable, Works on Windows, Crashes on Linux

  • 3 Replies
  • 6820 Views
LWJGL3 Stable, Works on Windows, Crashes on Linux
« on: September 23, 2015, 20:52:38 »
So, I've been working on this 3D game engine for about a week now and everything's been great, I love GLFW and so on. Well, yesterday I thought I should try running the game engine under a Debian Wheezy x64 VM, I built it and packaged it into a zip with native linux libraries and sent it over to my linux vm. I installed OpenJDK 8 on the virtual machine and tried running the program and this "java.lang.reflect.InvocationTargetException" comes up before the program gets to do anything.

Is this a common issue? I've been trying but can't seem to be able to fix it. I've tried building it with JDK7 and running on JDK7 or JDK8, no luck, always this same error.

Here's the exception in it's full glory;
Code: [Select]
harha@deb-x64vm:~/Desktop/mirageengine$ java -jar mirage.jar
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1864)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at org.lwjgl.LWJGLUtil.loadLibrarySystem(LWJGLUtil.java:337)
at org.lwjgl.Sys.<clinit>(Sys.java:29)
at org.lwjgl.LWJGLUtil.initialize(LWJGLUtil.java:309)
at org.lwjgl.system.MemoryUtil.<clinit>(MemoryUtil.java:35)
at org.lwjgl.Pointer.<clinit>(Pointer.java:22)
at org.lwjgl.PointerBuffer.<init>(PointerBuffer.java:24)
at org.lwjgl.PointerBuffer.allocateDirect(PointerBuffer.java:281)
at org.lwjgl.BufferUtils.createPointerBuffer(BufferUtils.java:190)
at org.lwjgl.system.libffi.Closure.<clinit>(Closure.java:45)
at org.lwjgl.glfw.Callbacks.errorCallbackPrint(Callbacks.java:129)
at io.github.harha.mengine.core.CoreEngine.init(CoreEngine.java:55)
at io.github.harha.game.Main.main(Main.java:17)
... 5 more

I honestly can't figure out what causes this, been googling the exception, etc... I don't understand why it whines about a wrong lwjgl path, the natives are in the same folder as the jar, just like on windows, and on windows that works fine. And I remember in LWJGL 2.x building a project like this worked fine for linux builds as well.

Edit:

Well, I tried system.setproperty for the native library path by setting it to "./" and that seems to have gotten rid of that error, but still the same InvocationTargetException comes up, this time whining the display handle was 0, so display failed to set-up.

Code: [Select]
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.RuntimeException: Failed to create the requested GLFW window context.
at io.github.harha.mengine.rendering.Window.init(Window.java:45)
at io.github.harha.mengine.core.CoreEngine.init(CoreEngine.java:58)
at io.github.harha.game.Main.main(Main.java:19)
... 5 more

...  :(
« Last Edit: September 23, 2015, 21:06:23 by Harha »

*

Offline spasi

  • *****
  • 2261
    • WebHotelier
Re: LWJGL3 Stable, Works on Windows, Crashes on Linux
« Reply #1 on: September 24, 2015, 10:08:20 »
I don't understand why it whines about a wrong lwjgl path, the natives are in the same folder as the jar, just like on windows, and on windows that works fine. And I remember in LWJGL 2.x building a project like this worked fine for linux builds as well.

System.loadLibrary does not specify what the default java.library.path is. On Linux, the current working directory is not included there. On Windows and OSX it is, that's why it works for you on Windows but not on Linux. The next nightly build (3.0.0b #37) will try to load shared libraries from the current working directory, if everything else fails.

this time whining the display handle was 0, so display failed to set-up.

Code: [Select]
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.RuntimeException: Failed to create the requested GLFW window context.
at io.github.harha.mengine.rendering.Window.init(Window.java:45)
at io.github.harha.mengine.core.CoreEngine.init(CoreEngine.java:58)
at io.github.harha.game.Main.main(Main.java:19)
... 5 more

This sounds like an issue with the VM. Could you please make sure that OpenGL works on there? Try a native OpenGL app. If it does work, could you please post the full stacktrace? The one above doesn't provide much information.

*

Offline SHC

  • **
  • 94
    • GoHarsha.com
Re: LWJGL3 Stable, Works on Windows, Crashes on Linux
« Reply #2 on: September 24, 2015, 15:01:31 »
I suspect that this is a VM? Generally speaking, VM softwares like VirtualBox or VMWare provide a max of 128 MB VRAM, which is not sufficient for a OpenGL context. Also the drivers are not available that use the host machine's GPU, everything will be virtual. Is that the case?

*

Offline spasi

  • *****
  • 2261
    • WebHotelier
Re: LWJGL3 Stable, Works on Windows, Crashes on Linux
« Reply #3 on: September 24, 2015, 16:12:43 »
Yes, he's running under a VM:

try running the game engine under a Debian Wheezy x64 VM