Open Ali-RS opened 1 year ago
So without reading the stackoverflow link, I can tell you we had the exact same problem, but just the opposite when switching to Java 11. The ABI/API has changed, and as such both versions aren't really interchangeable, as far as I understand.
I'd need to look into the link (and you can do something by splitting into modules/classes that you load dynamically that implement an interface), but the ultimate solution would be to use the regular lwjgl2 release for java <= 8 and to use my fork starting with java 11 anyway.
Edit: note that this may also apply to jme itself.
but the ultimate solution would be to use the regular lwjgl2 release for java <= 8 and to use my fork starting with java 11 anyway.
Note that If I build the lwjgl.jar with java 8 (using jars
ant task) and only use the natives from your fork it will work fine on both java 8 and 11+.
Please see: https://github.com/MeFisto94/lwjgl/compare/master...Ali-RS:lwjgl:master
I updated github workflow to build it with java 8 and disabled compiling natives and instead uploaded the precompiled linux natives. The liblwjgl64.so
is compiled with java 11 I grabbed from your fork.
Also applied lwjgl2-primarymonitor-patch-xrandr made by @riccardobl that partially fix https://github.com/jMonkeyEngine/jmonkeyengine/issues/947 (we still have the AWT issue sometimes returning incorrect display mode that needs to be settled as well. see https://github.com/jMonkeyEngine/jmonkeyengine/issues/1890#issuecomment-1372630501).
In the tests I did it works fine with java 8 and 11+. (it resolves https://github.com/jMonkeyEngine/jmonkeyengine/issues/1247 and https://github.com/jMonkeyEngine/jmonkeyengine/issues/1215)
Now we need to decide how to ship it to maven central in org.jmonkeyengine.lwjgl
and move this to JME GitHub.
Hi @MeFisto94
I am getting this exception when using java 8
See this for more details:
https://stackoverflow.com/questions/61267495/exception-in-thread-main-java-lang-nosuchmethoderror-java-nio-bytebuffer-flip
I tried approach 1 described above by adding release="8" when building with java 11 but I did not succeed. The error still happens.
Another approach is to find and cast all ByteBuffers to Buffer before calling flip(), limit(),... methods. Seems we should update lots of code this way.
Can we use java 8 to build the lwjgl.jar and only use java 11 for building natives?
Or do you know a better solution?