开发者

What am I doing wrong when trying to run the this java test command for 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-75F6

Directory 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?


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):

java -cp jar\lwjgl.jar;jar\lwjgl_test.jar;jar\lwjgl_util.jar -Djava.library.path=native\windows org.lwjgl.test.WindowCreationTest

Note that I removed the unused jars from the classpath since you only want to run the WindowCreationTest example.


Check again that directory

C:\Users\Nestor\Downloads\lwjgl-2.6\lwjgl-2.6\native\windows

exists and contains lwjgl.dll and lwjglaudio.dll

I believe that something is wrong with your installation, i.e. the directory does not exist or files are not there.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜