Re: NoClassDefFoundError
Morten Andersen <[email protected]>
| Newsgroups | gmane.comp.windows.devel.jawin |
|---|---|
| Message-ID | <[email protected]> |
Hi Roy and Christophe Hopefully I can clear things up a bit. There are two things you need to use Jawin: 1) The native code: jawin/bin/jawin.dll (it seems this is the one Roy is talking about). 2) The Java classes: jawin/lib/jawin.jar (it seems this is the one Christophe is talking about, and the one that causes trouble). *ad 2 - the jar file)* Like for all other Java projects you first and foremost need to get the jar file into your applications classpath. Since it is packaged in a .jar-file, the location of it doesn't matter [1], you will have no matter what have to include it actively in your classpath. I assume you are launching your program from a console with the "java ..." command? If not, please mail back. Then you should set the classpath "on-the-fly" as: java -classpath %CLASSPATH%;c:/jawin-1.0.19/lib/jawin.jar "YourProgram" (where I assume jawin is in the root of C:. And that you of course substitute "YourProgram" with the relevant class for you program). *ad 1 - the dll file)* This should be set exactly as mentioned in the Jawin introduction: java -Djava.library.path=c:/jawin-1.0.19/bin (again assuming Jawin is in the root of C:) *So to sum thing up* This will give us a full launch command like: java -classpath %CLASSPATH%;c:/jawin-1.0.19/lib/jawin.jar -Djava.library.path=c:/jawin-1.0.19/bin "YourProgram" The classpath part MAY accept backward slashes instead of the forward slashes. But for the java.library.path part I think you MUST use forward slashes (although I haven't time pt. to test that it will not work with backward slashes, I assume this is the case). So note that the option for including the jar file, includes the jar file itself. Whereas the option for including the dll file, only points to the directory containing the dll file (yes, this is not very consistent :-) - but thats just the way the JRE are). Best Regards, and hopes this helps you Morten notes: [1] Unless you are running in e.g. an application server or have your java.ext.dir-property set to the folder containing the jar-file. DON'T do this, unless you know what you are doing, and the consequences of it. Roy Collins wrote: [SNIP]