2017-11-21 6 views
0

Ich habe an einem Projekt gearbeitet, in dem wir LWJGL verwenden. Wir haben keine Probleme diese Zeile in Version 3.1.3Problem mit StackPush() in LWJGL 3.1.4 - NoSuchMethodError

val stack: MemoryStack = stackPush 

Allerdings läuft diese Linie stellt, wenn ein Gradle Projekt erstellen 3.1.4 verwenden, in denen die nativen Bibliotheken gezogen werden durch Gradle in, dieser Build verwenden. 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" 
} 

und ich erhalte den folgenden Fehler:

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. 

Mein Verdacht ist, dass irgendwo ein verlegtes dll verursacht Probleme, haben aber Glück gehabt, dass das Aufspüren. Hat jemand anderes ähnliche Probleme mit 3.1.4 von LWJGL?

Danke!

Antwort

0

Ich hatte den gleichen Fehler und von Slack Spasi kommentiert:

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 to 3.1.4 except compiled with Java 8)

+0

Vielen Dank, das ist genau die Lösung, die ich brauchte! –