VM arguments in Eclipse: -Djava.library.path
Hi,
new to the forum so be kind. I am debugging someone elses code. It looks like they were using alot of Eclipse libraries so I just downloaded Eclipse and I am currently stumbling around the Eclipse environment like a frat boy in New Orleans during Marde Gras. I imported all of the relevant pieces of the project but when I try to run it I get the following:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-win32-3138 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.eclipse.swt.internal.Library.loadLibrary(Library.java:123)
at org.eclipse.swt.internal.win32.OS.<clinit>(OS.java:18)
at org.eclipse.swt.widgets.Display.<clinit>(Display.java:125)
at WlyPackage.PVShader.<init>(PVShader.java:217)
at WlyPackage.PVShader.main(PVShader.java:2865)
I ran a search on the Exception and found some reference to VM arguments , in particular they recommended using "-Djava.library.path=...path". Can someone explain to me the purpose of VM arguments and why this might be the solution? It just seems odd to me that I would need to do this if I have just imported (into my project in Eclipse) all of the relevant libraries.
[1354 byte] By [
magasakaa] at [2007-10-2 20:14:49]

I'm a bit confused with that error. That native library is contained within a Jar file and should be loaded as part of the running of Eclipse. It is contained in plugins\org.eclipse.swt.win32.win32.x86_3.1.2.jar in Eclipse 3.1.2 and, based on the version number it looks like you might be running a slightly older version than 3.1.2. But I would guess that it is still in that Jar file.
Either way adding to java.library.path will not find the DLL for you. Under Windows the java.library.path is the same as adding a directory to your PATH environment variable. It is mean to tell the O/S where to find DLLs.
The only way I know to handle this is to extract the DLL from the Jar file first. Then your application will be able to load it.
First off, thank you for the reply. I agree, that error is confusing. I checked the class path in the manifest and it has swt.jar as the first entry. I tried simply adding a variable in Project --> Properties --> Build Path --> Libraries. I selected Eclipse_Home and clicked the extend button, chose the path to my desktop where the eclipse folder is found. It had swt.jar in there. It also had a similar DLL but it was a newer version "..89" instead of ".88" , which the code is specifically looking for. Any ideas why it would be looking for an older version of the DLL? Well, I'm going to try what you suggested and also maybe attach the swt.jar directly to the project. thanks again.
I think the following steps will solve your problem.
put the dll file in to the respective folder in your computer.
"jdk1.5.0_07\jre\bin".
put the swt.jar file in to the folder
"jdk1.5.0_07\jre\lib\ext".
Now start your eclipse. Now you will see that swt.jar included in your std jar collection itself.
This is what I did and its working.
Cheers,
neodishanku