简体   繁体   中英

NetBeans Slick2D setup problems

I just followed the Slick2D setup tutorial located Here , and then copied the "Hello World" project from the same wiki. I changed all of the class references and library references so they were named correctly, and tried to run it. Got this error.

Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1865)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1122)
    at org.lwjgl.Sys$1.run(Sys.java:72)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
    at org.lwjgl.Sys.loadLibrary(Sys.java:96)
    at org.lwjgl.Sys.<clinit>(Sys.java:117)
    at org.lwjgl.opengl.Display.<clinit>(Display.java:135)
    at org.newdawn.slick.AppGameContainer$1.run(AppGameContainer.java:39)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.newdawn.slick.AppGameContainer.<clinit>(AppGameContainer.java:36)
    at MyGame.mainClass.main(mainClass.java:39)

There is an image which describes how I have the folders laid out.

I honestly have no idea what is going on here. I tried re creating the entire project and creating all the folders again, and still the same error.

Thanks for anyone who takes the time to try and answer this.

Your Error says that it can't find lwjgl your library, that means you missed adding the lwjgl to your libraries.

Maybe this helps you:

http://wiki.lwjgl.org/wiki/Setting_Up_LWJGL_with_NetBeans

You basically install the library the same way you installed the slick2d library, furthemore you need to set lwjgl as native library:

This Screenshot is from eclipse but it shows a slick2d project with some additional stuff. Make your native library location points on lwjgl native folder and make sure you have all the other lwjgl files in your project. In case you don't know how to set native library location in netbeans check this link:

https://community.oracle.com/thread/3554856?start=0&tstart=0

在此处输入图片说明

My answer/contribution is about a year and a half too late, but hopefully this will help someone else (or maybe even the op if he/she never got it working)...

Right click your project (top icon in side list) Click 'Properties' (bottom menu item in popup) Select 'Run' from the available choices, and... at the bottom, there is a box titled 'XXX'

Assuming you have installed LWJGL on your computer, type in the path to the LWJGL native libraries Below is what I type in - and it works fine.

-Djava.library.path=C:\Java\lwjgl-2.9.3\native\windows
  • if you're running other-than Windows, your path will end differently

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM