我正在嘗試使用lwjgl庫,我將從頭開始新的Windows 7安裝。當我嘗試運行LWJGL的java測試命令時,我做了什麼錯誤?
我從Oracle網站下載了最新的JDK 6。安裝完成後,我發現沒有從Windows cmd提示符識別「java」或「javac」等命令。所以,我編輯了我的路徑變量,並附加了jdk的bin文件夾。
現在的Java命令的工作。
所以,我下載最新的LWJGL,提取並閱讀其網站上installation instructions:
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
所以,我摘錄了它,並在命令提示符導航到提取的文件夾。
然後我執行的測試命令上述規定,我得到以下錯誤:
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>
爲什麼會出現這個錯誤?我不明白爲什麼應該存在鏈接錯誤。在我試圖執行它明確規定了的路徑,這些原生的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
我已經證實了相對路徑「本土\ WINDOWS」包含這些依賴關係:
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
任何人都可以指出我做錯了什麼嗎?任何人都可以通過下載LWJGL庫並嘗試運行安裝說明中給出的測試命令來重現此問題嗎?
謝謝隊友!對此,我真的非常感激。 – KingNestor 2010-12-05 03:45:21