Hi all, developing on Mac OS Yosemite, using netbeans. I'm quite new to Java and have only just started my venture into LWJGL.
I have used the demo code from the LWJGL guide page. I ran it in netbeans and at first got the exception: "java.lang.IllegalStateException: Please run the JVM with -XstartOnFirstThread".
After adding -XstartOnFirstThread to the arguments the code ran fine.
However, after building the code into a jar and running it from terminal I get the following:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Failed to load the native library: lwjgl
at org.lwjgl.LWJGLUtil.loadLibrarySystem(LWJGLUtil.java:339)
at org.lwjgl.Sys$1.run(Sys.java:36)
at java.security.AccessController.doPrivileged(Native Method)
at org.lwjgl.Sys.<clinit>(Sys.java:33)
at lwtest.LWTest.run(LWTest.java:34)
at lwtest.LWTest.main(LWTest.java:124)
Any ideas?
Thanks in advanced.
Try this:
Download the LWJGL natives, and run with something like this:
java -Djava.library.path="PATH/TO/NATIVES/macosx/" -jar PATH_TO_JAR
Let me know if it works 8)
@wxwsk8er is right, you have to tell LWJGL where to find the natives. If you want to make it more simple, place the natives folder in the class-path besides the JAR, and add this piece of code to the main class.
static
{
System.setProperty("java.library.path", new File("natives").toPath().toString());
}
What this does is it sets that property from the code, simplifying the setup required to be done by the user.