尝试运行LWJGL"Hello World"时,如何解决此JNI错误? [英] How to resolve this JNI error when trying to run LWJGL "Hello World"?

查看:166
本文介绍了尝试运行LWJGL"Hello World"时,如何解决此JNI错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从LWJGL网站上运行示例"Hello World"

I'm trying to run the sample "Hello World" from the LWJGL website

通过此链接: LWJGL入门"

我正在尝试通过命令行执行此操作,只是为了让我更好地理解幕后".

I'm trying to do this via the command line, just so I understand the "behind the scenes" a bit better.

我已经成功地进行了编译,没有任何错误,但是当我尝试运行该程序时,却出现了此错误:

I've managed to compile without any errors, but when I try to run the program I'm getting this error:

C:\JavaProjects\LearningLWJGL>java -classpath .;./lib/*.jar -Djava.library.path=C:\Windows\System32 HelloWorld
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/lwjgl/glfw/GLFWKeyCallback
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
    at java.lang.Class.privateGetMethodRecursive(Unknown Source)
    at java.lang.Class.getMethod0(Unknown Source)
    at java.lang.Class.getMethod(Unknown Source)
    at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
    at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.lwjgl.glfw.GLFWKeyCallback
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 7 more

有什么想法吗?

推荐答案

CLASSCLASS条目是.class文件或.jar文件的包层次结构开头的目录.如果您期望./lib在该目录中包含所有.jar文件,则不会.您必须明确命名它们.

A CLASSPATH entry is either a directory at the head of a package hierarchy of .class files, or a .jar file. If you're expecting ./lib to include all the .jar files in that directory, it won't. You have to name them explicitly.

这篇关于尝试运行LWJGL"Hello World"时,如何解决此JNI错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆