I've been working on a project in which we use LWJGL. We have no problems running this line in version 3.1.3
val stack: MemoryStack = stackPush
However, this line trips up when create a Gradle project using 3.1.4, in which the native libraries are pulled in by Gradle, using this build.gradle:
import org.gradle.internal.os.OperatingSystem
version '1.0-SNAPSHOT'
apply plugin: 'scala'
switch ( OperatingSystem.current() ) {
case OperatingSystem.WINDOWS:
project.ext.lwjglNatives = "natives-windows"
break
case OperatingSystem.LINUX:
project.ext.lwjglNatives = "natives-linux"
break
case OperatingSystem.MAC_OS:
project.ext.lwjglNatives = "natives-macos"
break
}
project.ext.lwjglVersion = "3.1.4" //if this is 3.1.3 it works
repositories {
mavenCentral()
}
dependencies {
compile "org.lwjgl:lwjgl:$lwjglVersion"
compile "org.lwjgl:lwjgl-opencl:$lwjglVersion"
runtime "org.lwjgl:lwjgl:$lwjglVersion:$lwjglNatives"
}
and I get the following error:
java.lang.NoSuchMethodError: java.nio.ByteBuffer.limit(I)Ljava/nio/ByteBuffer;
at org.lwjgl.system.MemoryAccess$MemoryAccessorUnsafe.getCapacityOffset(MemoryAccess.java:159)
at org.lwjgl.system.MemoryAccess$MemoryAccessorUnsafe.<clinit>(MemoryAccess.java:132)
at org.lwjgl.system.MemoryAccess.getInstance(MemoryAccess.java:31)
at org.lwjgl.system.MemoryUtil.<clinit>(MemoryUtil.java:62)
at org.lwjgl.system.MemoryStack.<init>(MemoryStack.java:60)
at org.lwjgl.system.MemoryStack.create(MemoryStack.java:81)
at org.lwjgl.system.MemoryStack.create(MemoryStack.java:70)
at java.lang.ThreadLocal$SuppliedThreadLocal.initialValue(ThreadLocal.java:284)
at java.lang.ThreadLocal.setInitialValue(ThreadLocal.java:180)
at java.lang.ThreadLocal.get(ThreadLocal.java:170)
at org.lwjgl.system.MemoryStack.stackGet(MemoryStack.java:603)
at org.lwjgl.system.MemoryStack.stackPush(MemoryStack.java:612)
at JavaFXCanvas.main(JavaFXCanvas.java:16)
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:498)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
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:498)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
[LWJGL] [MemoryAccessor] Unsupported JVM detected, this will likely result in low performance. Please inform LWJGL developers.
My suspicion is that somewhere a misplaced dll is causing issues, but haven't had luck tracking that down. Has anyone else encountered similar issues with 3.1.4 of LWJGL?
Thanks!
I had the same error and from Slack Spasi commented:
the problem is https://bugs.openjdk.java.net/browse/JDK-4774077, workaround: either use Java 9 or the
3.1.4 snapshot 8
(it's identical to3.1.4
except compiled with Java 8)