当尝试为 LWJGL 运行此 java 测试命令时,我做错了什么?
我正在尝试使用 lwjgl 库,并且我从头开始安装新的 Windows 7。
我从Oracle网站下载了最新的JDK 6。安装后,我发现 Windows cmd 提示符无法识别“java”或“javac”等命令。因此,我编辑了路径变量并将 jdk 的 bin 文件夹附加到其中。
现在java命令可以工作了。
因此,我下载了最新的 lwjgl,将其解压并阅读其网站上的安装说明:
下载发行版解压 存档,文件内容(在子 文件夹)应包括(除其他外) 东西):
lwjgl.dll lwjglaudio.dll lwjgl.jar lwjgl_util.jar lwjgl_test.jar
java -cp .;res;jar\lwjgl.jar;jar\lwjgl_test.jar;jar\lwjgl_util.jar;jar\lwjgl_fmod3.jar;jar\lwjgl_devil.jar;jar\jinput.jar;-Djava.library .path=native\windows org.lwjgl.test.WindowCreationTest
测试 LWJGL 通过打开命令提示符,以及 导航到该文件夹所在的位置 存档已提取。一旦导航, 发出以下命令:(全部在 一行,每个选项前有一个空格)应该会出现一个窗口,您应该 请参阅以下输出:
发现显示模式240、320、 WindowCreationTest 显示已创建 移动到 100,100 个窗口创建了 600 个, 800,游戏
所以,我提取了它并在cmd提示符下导航到提取的文件夹。
然后我执行上面指定的测试命令,出现以下错误:
C:\Users\Nestor\Downloads\lwjgl-2.6\lwjgl-2.6>java -cp .;res;jar\lwjgl.jar;jar\ lwjgl_test.jar;jar\lwjgl_util.jar;jar\lwjgl_fmod3.jar;jar\lwjgl_devil.jar;jar\ji nput.jar;-Djava.library.path=native\windows org.lwjgl.test.WindowCreationTest
这 以下按键可用: ESCAPE: 退出测试 箭头键:移动窗口 当处于非全屏模式时 L:
列出可选择的显示模式 0-8:
显示模式选择F:
切换全屏 SHIFT-F:
切换全屏 Display.destroy()/create()循环 线程“main”中出现异常 java.lang.UnsatisfiedLinkError: 否 java.libr ary.path 中的 lwjgl 在 java.lang.ClassLoader.loadLibrary(ClassLoader.java:1734) 在 java.lang.Runtime.loadLibrary0(Runtime.java:823) 在 java.lang.System.loadLibrary(System.java:1028) 在 org.lwjgl.Sys$1.run(Sys.java:73) 在java.security.AccessController.doPrivileged(本机 方法) 在 org.lwjgl.Sys.doLoadLibrary(Sys.java:66) 在 org.lwjgl.Sys.loadLibrary(Sys.java:82) 在 org.lwjgl.Sys.(Sys.java:99) 在 org.lwjgl.opengl.Display.(Display.java:130) 在 org.lwjgl.test.WindowCreationTest.initialize(WindowCreationTest.java: 82) 在 org.lwjgl.test.WindowCreationTest.main(WindowCreationTest.java:286)C:\Users\Nestor\Downloads\lwjgl-2.6\lwjgl-2.6>
为什么我会收到这个错误?我不明白为什么会有链接错误。在我尝试执行的命令中,它清楚地说明了它所需的本机 dll 的路径:
C:\Users\Nestor\Downloads\lwjgl-2.6\lwjgl-2.6>java -cp .;res;jar\lwjgl.jar;jar\ lwjgl_test.jar;jar\lwjgl_util.jar;jar\lwjgl_fmod3.jar;jar\lwjgl_devil.jar;jar\ji nput.jar;-Djava.library.path=native\windows org.lwjgl.test.WindowCreationTest
我已经确认相对路径“native\windows”包含这些依赖项:
C:\Users\Nestor\Downloads\lwjgl-2.6\lwjgl-2.6\native\windows>dir
驱动器 C 中的卷没有标签。
卷序列号为 2061-75F6目录 C:\Users\Nestor\Downloads\lwjgl-2.6\lwjgl-2.6\native\windows
2010/11/24 12:35 .
11/24/2010 12:35 上午 ..
10/18/2010 08:44 PM 31,232 jinput-dx8.dll
10/18/2010 08:44 PM 65,024 jinput-dx8_64.dll
10/18/2010 08:44 PM 29,696 jinput-raw.dll
10/18/2010 08:44 PM 62,464 jinput-raw_64.dll
10/18/2010 08:44 PM 197,120 lwjgl.dll
10/18/2010 08:44 PM 305,664 lwjgl64.dll
10/18/2010 08:44 PM 56,832 OpenAL32.dll
10/18/2010 08:44 PM 157,184 OpenAL64.dll
8 个文件 905,216 字节
2 个目录 155,163,058,176 字节可用
任何人都可以帮助指出我做错了什么吗?任何人都可以通过下载 LWJGL 库并尝试运行安装说明中给出的测试命令来重现此问题吗?
I'm attempting to use the lwjgl library and I'm starting from scratch on a new Windows 7 install.
I downloaded the latest JDK 6 from the Oracle website. After installing it, I found that commands like "java" or "javac" weren't being recognized from a windows cmd prompt. So, I edited my path variable and appended the jdk's bin folder to it.
Now the java commands work.
So, I download the latest lwjgl, extract it and read the installation instructions on their website:
Download the distribution Unpack the
archive, file contents (in sub
folders) should include (amongst other
things):lwjgl.dll lwjglaudio.dll lwjgl.jar
lwjgl_util.jar lwjgl_test.jar
Test
LWJGL by opening a command prompt, and
navigating to the folder where the
archive was extracted. Once navigated,
issue the following command: (all in
one line, space before each -option)java -cp .;res;jar\lwjgl.jar;jar\lwjgl_test.jar;jar\lwjgl_util.jar;jar\lwjgl_fmod3.jar;jar\lwjgl_devil.jar;jar\jinput.jar;-Djava.library.path=native\windows org.lwjgl.test.WindowCreationTest
A window should appear and you should
see the following output:Found display modes 240, 320,
WindowCreationTest Display created
Moving to 100, 100 Window created 600,
800, Game
So, I extracted it and navigated to the extracted folder in a cmd prompt.
I then executed the test command specified above and I get the following error:
C:\Users\Nestor\Downloads\lwjgl-2.6\lwjgl-2.6>java
-cp .;res;jar\lwjgl.jar;jar\ lwjgl_test.jar;jar\lwjgl_util.jar;jar\lwjgl_fmod3.jar;jar\lwjgl_devil.jar;jar\ji
nput.jar;-Djava.library.path=native\windows
org.lwjgl.test.WindowCreationTest
The
following keys are available: ESCAPE:
Exit test ARROW Keys: Move window
when in non-fullscreen mode L:
List selectable display modes 0-8:
Selection of display modes F:
Toggle fullscreen SHIFT-F:
Toggle fullscreen with
Display.destroy()/create() cycle
Exception in thread "main"
java.lang.UnsatisfiedLinkError: no
lwjgl in java.libr ary.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1734)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
at org.lwjgl.Sys$1.run(Sys.java:73)
at java.security.AccessController.doPrivileged(Native
Method)
at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
at org.lwjgl.Sys.loadLibrary(Sys.java:82)
at org.lwjgl.Sys.(Sys.java:99)
at org.lwjgl.opengl.Display.(Display.java:130)
at org.lwjgl.test.WindowCreationTest.initialize(WindowCreationTest.java:
82)
at org.lwjgl.test.WindowCreationTest.main(WindowCreationTest.java:286)C:\Users\Nestor\Downloads\lwjgl-2.6\lwjgl-2.6>
Why am I getting that error? I don't understand why there should be linking errors. In the command that I attempted to execute it clearly spells out the path to those native dll's it needs:
C:\Users\Nestor\Downloads\lwjgl-2.6\lwjgl-2.6>java
-cp .;res;jar\lwjgl.jar;jar\ lwjgl_test.jar;jar\lwjgl_util.jar;jar\lwjgl_fmod3.jar;jar\lwjgl_devil.jar;jar\ji
nput.jar;-Djava.library.path=native\windows
org.lwjgl.test.WindowCreationTest
I've confirmed that the relative path "native\windows" contains those dependencies:
C:\Users\Nestor\Downloads\lwjgl-2.6\lwjgl-2.6\native\windows>dir
Volume in drive C has no label.
Volume Serial Number is 2061-75F6Directory of C:\Users\Nestor\Downloads\lwjgl-2.6\lwjgl-2.6\native\windows
11/24/2010 12:35 AM .
11/24/2010 12:35 AM ..
10/18/2010 08:44 PM 31,232 jinput-dx8.dll
10/18/2010 08:44 PM 65,024 jinput-dx8_64.dll
10/18/2010 08:44 PM 29,696 jinput-raw.dll
10/18/2010 08:44 PM 62,464 jinput-raw_64.dll
10/18/2010 08:44 PM 197,120 lwjgl.dll
10/18/2010 08:44 PM 305,664 lwjgl64.dll
10/18/2010 08:44 PM 56,832 OpenAL32.dll
10/18/2010 08:44 PM 157,184 OpenAL64.dll
8 File(s) 905,216 bytes
2 Dir(s) 155,163,058,176 bytes free
Can anyone help point out what I'm doing wrong? Can anyone reproduce this by downloading the LWJGL library and attempting to run the test command given in the installation instructions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
看来您的类路径参数 (
-cp jar1.jar;jar2.jar
) 和系统属性设置 (-D. .
)。例如,您的类路径看起来像这样
-cp .;res;jar\lwjgl.jar;jar\lwjgl_test.jar;jar\lwr...;-Djava.library.path=native\windows
。这样,java 就会像类路径一样解释本机库路径参数的属性设置!只需在这些参数之间添加一个空格,您就应该启动并运行,这是正确的命令(也在 Windows 7 上进行了测试):
请注意,我从类路径中删除了未使用的 jar,因为您只想运行 WindowCreationTest 示例。
It seems that you do not have a space between your classpath argument (
-cp jar1.jar;jar2.jar
) and your system property setting (-D..
).E.g. your classpath looks like this
-cp .;res;jar\lwjgl.jar;jar\lwjgl_test.jar;jar\lwr...;-Djava.library.path=native\windows
. This way java will interpret your property setting of native library path argument like a classpath!Just add a space between those arguments and you should be up and running, this is the corrected command (also tested on Windows 7):
Note that I removed the unused jars from the classpath since you only want to run the
WindowCreationTest
example.再次检查目录
是否存在并包含
lwjgl.dll
和lwjglaudio.dll
我相信您的安装有问题,即目录不存在或文件不存在。
Check again that directory
exists and contains
lwjgl.dll
andlwjglaudio.dll
I believe that something is wrong with your installation, i.e. the directory does not exist or files are not there.
只是把它扔在那里,因为我遇到了一些与此相关的问题。转到 Java/JRE/BIN 文件夹。右键单击 Java,然后转到属性。在“权限级别”下,选中“以管理员身份运行”复选框。
Just throwing this out there, because Ive had some issues related to this. Go to your Java/JRE/BIN folder. Right click on Java, and go to properties. Under Privilege Level, check the box by run as an administrator.