Eclipse 3.2, Win2000, 1.0Beta3, UnsatisfiedLinkError

Started by kwutzke, September 27, 2006, 13:59:12

Previous topic - Next topic

kwutzke

Hi all!

I have read at least 20 posts in both the LWJGL and jMonkey forums, but none of them really got me to the solution. I read the FAQ, the installation guide for Eclipse, anything I can think of, none worked!

BTW: The WindowCreationTest from the command prompt works fine, the window fades from black to white and back and so on...

Here's my setup:

Win2000
Eclipse 3.2
LWJGL 1.0Beta3 in C:\dev\lwjgl

The code I use is:

--------------

package odin;

import java.io.*;
import org.lwjgl.*;

public class Odin
{
   public static void main(String[] strArgs)
   {
      System.out.println("Hello Odin!");
      
      String strLibPath = System.getProperty("java.library.path");      
      System.out.println(strLibPath);
      
      File fl = new File(strLibPath);      
      String str = "defaultvalue";
      try
      {
         str = fl.getCanonicalPath();         
      }
      catch (Exception e)
      {
         e.printStackTrace();
      }      
      System.out.println("Dir is " + str);

      System.out.println("LWJGL version = " + Sys.getVersion());

      System.out.println("Goodbye Odin!");      
   }

}

--------------

I get the famous Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path...

The solution ought to be to go to "Run..." -> Tab (x)=Arguments -> Text area "VM arguments" and enter "-Djava.library.path="../native/win32" without ""..

It doesn't work. Running the above code produces the following:

Hello Odin!
../native/win32
Dir is C:\dev\native\win32
Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
   at java.lang.ClassLoader.loadLibrary(Unknown Source)
   at java.lang.Runtime.loadLibrary0(Unknown Source)
   at java.lang.System.loadLibrary(Unknown Source)
   at org.lwjgl.Sys$1.run(Sys.java:75)
   at java.security.AccessController.doPrivileged(Native Method)
   at org.lwjgl.Sys.doLoadLibrary(Sys.java:68)
   at org.lwjgl.Sys.loadLibrary(Sys.java:84)
   at org.lwjgl.Sys.<clinit>(Sys.java:101)
   at odin.Odin.main(Odin.java:36)

I've also tried using

-Djava.library.path="..\native\win32"
"-Djava.library.path="C:\dev\lwjgl\native\win32"
"-Djava.library.path="c:\dev\lwjgl\native\win32"

without success.

Could this have to with something different? In my Cygwin shell when entering "which java" or javaw, javaws, Windows' system32 is the place. I just see that Eclipse uses the one installed in "c:\jdk1.5.0_08" when running....

CAN ANYONE HELP PLEASE? I'm really out of clues here... for such a basic setup...

TIA!
Karsten

PS: My setup is absolutely nothing special and includes the very latest versions of every (piece of) software at the end of Sep 2006. For all having other versions: Please don't just reply, the directory structure in LWJGL has changed to
./native/linux
./native/macosx
./native/win32
so any old replies might not apply.....

Evil-Devil

have you applied the lwjgl jar files to your classpath?

Just a thought.

Fool Running

Just a shot in the dark (since I have no ideas :lol: ):
you said you tried "-Djava.library.path="C:\dev\lwjgl\native\win32"" so I assume that that is where it is installed, but when you run the program (I assume the output is not with that path specified) it prints out "Dir is C:\dev\native\win32". i.e. it looks like its missing the lwjgl part of the path.

I would be surprised if that was the cause if "-Djava.library.path="C:\dev\lwjgl\native\win32"" didn't work, though :lol:
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

Evil-Devil

Ah...you uses an absolute directory info. you have to apply the path as relative one. I got this error in the first time too. Don't know why, but it seems to me that eclipse only accepts relative pathes.

MarneusCalgarXP

Personnaly, I've just set:

-Djava.library.path=C:\dev\lwjgl\native\win32


No need the " symbols !!
Dark Skull Software
http://www.darkskull.net

kwutzke

Hmm still nothing is working... with Eclipse!

I modified the WindowCreationTest command line as written on page http://www.lwjgl.org/installation.php

from

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\win32 org.lwjgl.test.WindowCreationTest.java

to

java -cp .;bin;..\lwjgl\jar\lwjgl.jar;..\lwjgl\jar\lwjgl_test.jar;..\lwjgl\jar\lwjgl_util.jar;..\lwjgl\jar\lwjgl_fmod3.jar;..\lwjgl\jar\lwjgl_devil.jar;..\lwjgl\jar\jinput.jar; -Djava.library.path=..\lwjgl\native\win32 odin.Odin

And the program runs and terminates successfully.

-> odin.Odin resides in C:\dev\odin\bin\(odin\Odin.class), current dir is C:\dev\odin

Output is:

C:\dev\odin>java -cp .;bin;..\lwjgl\jar\lwjgl.jar;..\lwjgl\jar\lwjgl_test.jar;..\lwjgl\jar\lwjgl_util.jar;..\lwjgl\jar\lwjgl_fmod3.jar;..\lwjgl\jar\lwjgl_devil.jar;..\lwjgl\jar\jinput.jar; -Djava.library.path=..\lwjgl\native\win32 odin.Odin
Hello Odin!
..\lwjgl\native\win32
Dir is C:\dev\lwjgl\native\win32
LWJGL version = 1.0beta3
Goodbye Odin!

Runs perfectly... however, not with Eclipse's Run...

From the paths above, you can see the LWJGL dir is really set up correctly at C:\dev\odin\..\lwjgl that is C:\dev\lwjgl...

Hmmm... I set up the project *NOT* in the eclipse workspace folder... just to keep my projects untied to Eclipse... might there be a problem???

C:\dev\odin>java -cp .;bin;..\lwjgl\jar\lwjgl.jar; -Djava.library.path=..\lwjgl\native\win32 odin.Odin
Hello Odin!
..\lwjgl\native\win32
Dir is C:\dev\lwjgl\native\win32
LWJGL version = 1.0beta3
Goodbye Odin!

With only lwjgl.jar on the classpath produces the same output (easier to  debug).

Any further ideas???

Karsten

PS: Maybe it's time to hit the Eclipse forums...

MarneusCalgarXP

Strange Eclipse behaviour :shock:

I tried at home, it works for me ! have you added the lwjgl.jar to the project build path and execution path ?
Dark Skull Software
http://www.darkskull.net

kwutzke

Yes I did. At least I'm pretty sure. Otherwise, in the stack trace, the Sys <clinit> shouldn't work, but it does... a NoClassDefFoundException would be thrown...

Could it have anything to do with setting the Eclipse workspace to a different dir in C:\dev\eclipsews and having the main tree @ C:\dev\odin ...?

wolf_m

I've put the natives into the project and referenced them via the workspace_loc variable.

Putting the project into the workspace is recommended, but not really necessary. I've got an LWJGL project at a separate location and it runs just fine.

As a reference, I'll tell you how the eclipse project for Tetrismus is organized.

1. Directory structure:

Tetrismus
|_
..native
..|_
....linux [folder with linux natives]
..|_
....macosx [folder with macosx natives]
..|_
....win32 [folder with win32 natives]
..lib
..|_
....jar [folder with lwjgl jars]
..src
..|_
....game [folder with Tetrismus.java, the main class]


2. Build path includes all lwjgl jars and the jar base folder (probably unnecessary), but not the natives.

3. Launch configuration (win32):
Project: Tetrismus
Main class: game.Tetrismus
VM arguments: -Xmx256M -Djava.library.path=${workspace_loc:Tetrismus}/native/win32
Classpath: User entries: Tetrismus (default classpath)
Source Lookup Path: Default

The -Xmx256M part of the VM arguments is not necessary for you.

If it still doesn't work after rebuilding your project's structure as proposed, you may try these:
1. Delete all launch configurations and create a new one
2. Project -> Clean...
3. Close Eclipse, run it with the -clean flag
4. Delete all .launch files in $WORKSPACE/.metadata/.plugins/org.eclipse.debug.core/launches while Eclipse is closed, then start it with the -clean flag and create a new launch configuration.

Please give feedback. Good luck!

Evil-Devil

Really weird. Splited pathes should not do the problem. On my machine everthing is split up too and it works fine

Eclispse: C:\Programme\eclipse
Workspace: J:\Java\<MyProjekt>
LWJGL (natives): J:\Libs\Java\lwjgl\<version>\natives
LWJGL (jars): J:\Libs\Java\lwjgl\<version>\jar

Runs fine. For not typing each time the path i use Eclipse Variables (Argument Variables) for it.
Same goes with the library itself. (Eclipse User Library)

thygrrrr

Are you sure you create()'d the necessary singletons?

I get UnsatisfiedLinkErrors for instance if I don't IL.create() ... it's something that's easily overlooked :)