Java.library.path issue :(

I know this is a very comman ask according to the help url but I can't run anything at all.

I've followed the netbeans tutorial carefully and the same for exclipse and i get the same error in both IDEs. I have set the java.library.path and tried making it relative and absolute but its all been to no avail. I'm not sure what's going wrong…apart from the fact that it can't find lgwgl for soem reason.

I'm running the Helloworld program from the tutorials.

Here's the stacktrace



init:

Deleting: C:UsersCourtneyDocumentsprogrammingnetbeansWorkspace3DJ3Dbuildbuilt-jar.properties

deps-jar:

Updating property file: C:UsersCourtneyDocumentsprogrammingnetbeansWorkspace3DJ3Dbuildbuilt-jar.properties

Compiling 1 source file to C:UsersCourtneyDocumentsprogrammingnetbeansWorkspace3DJ3Dbuildclasses

compile-single:

run-single:

07-Mar-2010 22:50:35 com.jme.app.BaseGame start

INFO: Application started.

07-Mar-2010 22:50:35 com.jme.system.PropertiesGameSettings <init>

INFO: PropertiesGameSettings created

07-Mar-2010 22:50:35 com.jme.system.PropertiesGameSettings load

WARNING: Could not load properties. Creating a new one.

07-Mar-2010 22:50:35 com.jme.app.BaseSimpleGame initSystem

INFO: jME version 2.0 Stable (r4093)

07-Mar-2010 22:50:35 com.jme.input.joystick.DummyJoystickInput <init>

INFO: Joystick support is disabled

07-Mar-2010 22:50:35 com.jme.system.lwjgl.LWJGLDisplaySystem <init>

INFO: LWJGL Display System created.

07-Mar-2010 22:50:35 class org.J3D start()

SEVERE: Exception in game loop

java.lang.UnsatisfiedLinkError: no lwjgl in java.library.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:72)

       at java.security.AccessController.doPrivileged(Native Method)

       at org.lwjgl.Sys.doLoadLibrary(Sys.java:65)

       at org.lwjgl.Sys.loadLibrary(Sys.java:81)

       at org.lwjgl.Sys.<clinit>(Sys.java:98)

       at org.lwjgl.opengl.Display.<clinit>(Display.java:129)

       at com.jme.system.lwjgl.LWJGLDisplaySystem.getValidDisplayMode(LWJGLDisplaySystem.java:357)

       at com.jme.system.lwjgl.LWJGLDisplaySystem.selectMode(LWJGLDisplaySystem.java:498)

       at com.jme.system.lwjgl.LWJGLDisplaySystem.initDisplay(LWJGLDisplaySystem.java:411)

       at com.jme.system.lwjgl.LWJGLDisplaySystem.createWindow(LWJGLDisplaySystem.java:143)

       at com.jme.app.BaseSimpleGame.initSystem(BaseSimpleGame.java:381)

       at com.jme.app.BaseGame.start(BaseGame.java:70)

       at org.J3D.main(J3D.java:51)

07-Mar-2010 22:50:35 com.jme.app.BaseSimpleGame cleanup

INFO: Cleaning up resources.

07-Mar-2010 22:50:35 com.jme.app.BaseGame start

INFO: Application ending.

Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.lwjgl.opengl.Display

       at com.jme.system.lwjgl.LWJGLDisplaySystem.close(LWJGLDisplaySystem.java:313)

       at com.jme.app.BaseGame.quit(BaseGame.java:117)

       at com.jme.app.BaseSimpleGame.quit(BaseSimpleGame.java:614)

       at com.jme.app.BaseGame.start(BaseGame.java:107)

       at org.J3D.main(J3D.java:51)

Java Result: 1

BUILD SUCCESSFUL (total time: 1 second)



thanks in advance for any help

Hi, this should be a simple problem to fix… 



I see the example you posted is from Netbeans… I'm not very savvy with Netbeans, but I can certainly steer you through an Eclipse setup :slight_smile:



-In your Eclipse workspace, right-click the 'jme' project and select properties.

-Select 'Java Build Path' from the list on the left and then select the "Libraries" tab.

-In this tab, you should see a few libraries with names like "jinput.jar", "jogl.jar", and "lwjgl.jar"

-Select the arrow next to lwjgl.jar to expand it, select 'Native library location', and click edit.

-In the 'Library Folder Configuration' window that pops up, select the "Workspace…" button

-This will bring up a list of projects in your current Eclipse workspace, expand the jME project and look in lib/lwjgl.

-Within this folder, select the operating system that applies for you (looks to be Windows in your case) and click ok

-You will also want to make sure that you have the correct SWT jar selected…  Select "Add JARs" and once again expand the jme project.  Now select swt.jar in lib/swt/windows



You should now be able to run the build.xml to build the jME jar's as well as run the examples in the jmetest packages

I’m trying to run jme3/src/test/jme3test/awt/TestApplet.java, and get the common error:

Exception in thread “LWJGL Renderer Thread” java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path



This is apparently easy to fix, but I think the docs are for JME2, not JME3 because the arch specific libs are merged together somehow. In Eclipse, I’ve tried various ways of adding JME3-lwjgl-natives.jar, but nothing seems to work.

Ok, this is aparently half a year old, but anyways, if someone else (like me) stumbles upon the same error, here is the solution:



The Sample “TestCanvas.java” contains the following line:



[java]JmeSystem.setLowPermissions(true);[/java]



which apparently causes the program not to load native libraries like lwjgl (the responsible code resides in JMESystem.java initialize() ). If you comment out this line (the purpose of which I do not fully understand) the sample works perfectly.



greets,

dasding

The call lets the system know that its running under low permissions/privileges. Some things in jME3, like extracting natives or registering an uncaught exception handler, require elevated privileges which are not available when running in applet/webstart

The canvas application is certainly not an applet. Why was this line included without ensuring that the needed libraries are loaded otherwise?

Ah I see now. Yeah its a copy and paste error, fixed in SVN