gpt4 book ai didi

scala - 在 LWJGL 3.1.4 中使用 stackPush() 时遇到问题 - NoSuchMethodError

转载 作者:行者123 更新时间:2023-12-03 05:51:43 31 4
gpt4 key购买 nike

我一直在做一个使用 LWJGL 的项目。我们在 3.1.3 版本中运行这条线没有问题

val stack: MemoryStack = stackPush

但是,当使用 3.1.4 创建 Gradle 项目时,这条线会出错,其中 native 库是由 Gradle 使用此 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"
}

我收到以下错误:
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.

我的怀疑是某个地方放错了 dll 导致问题,但没有运气追踪到。有没有其他人遇到过 LWJGL 3.1.4 的类似问题?

谢谢!

最佳答案

我遇到了同样的错误,来自 Slack Spasi 的评论说:

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)

关于scala - 在 LWJGL 3.1.4 中使用 stackPush() 时遇到问题 - NoSuchMethodError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47415181/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com