aspose file tools*
The moose likes Beginning Java and the fly likes Confusing UnsatisfiedLinkError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Confusing UnsatisfiedLinkError" Watch "Confusing UnsatisfiedLinkError" New topic
Author

Confusing UnsatisfiedLinkError

Jonathan Caldwell
Greenhorn

Joined: Aug 30, 2012
Posts: 21
I am still working on this same project for school,
I finished all of the code, now out of "nowhere" I can't compile I can't run ?

I am getting this error:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no CumulusJC 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)


The JAR file its looking for is right where eclipse thinks it should be.
-classpath shows the JAR file
I set native library location to the JAR location as well...

still getting this same error?

at TESTER.main(TESTER.java:19)
(line 19)

(the first reference to the JAR)
any suggestions?
Vishal Shaw
Ranch Hand

Joined: Aug 09, 2012
Posts: 179
Hi,

I haven't used Cumulus , but I think your problem relates to setting some resource paths in your environment variable . Check out this link

Vishal


Programming is about thinking, NOT coding
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14273
    
  21

This error means that your Java program is trying to load a native library which it cannot find. If you're running on Windows, it's looking for a DLL named CumulusJC.dll.

When you start your Java program, you have to specify on the command line where the DLL is, like this:

java -Djava.library.path=C:\dir\that\contains\the\library com.mypackage.MyMainClass

If you're running your program from Eclipse, select Run / Run Configurations, and then in the Arguments tab specify the -Djava.library.path=C:\dir\that\contains\the\library.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Jonathan Caldwell
Greenhorn

Joined: Aug 30, 2012
Posts: 21
Thanks!

Cumulus is a digital asset management software, its interesting; I am building extensions.

(well, I am trying)

This link sent me in the right direction.

It seems the poster and I are in a similar situation.

(except I'm not using Mac, and this is in reference to an older version of cumulus)

so I tried to add a VM argument to eclipse project, but now I get this error:


java.lang.NoClassDefFoundError: Files/Canto/Cumulus
Caused by: java.lang.ClassNotFoundException: Files.Canto.Cumulus
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)

So maybe there are multiple problems?


since I am using eclipse, I am kind of weary of using command line to work around. (since I have tried similar things in the past, and eclipse seems to like to play on its own terms)



Thanks Again
*



Jonathan Caldwell
Greenhorn

Joined: Aug 30, 2012
Posts: 21
Just as a note of further confusion on my part; on Friday, this program was compiling.

I came back on Monday, and PATH ERROR overload!

Is it possible that there is something outside of my doing that could have caused this to happen?

*
*

Baffled

*
*

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14273
    
  21

Jonathan Caldwell wrote:java.lang.NoClassDefFoundError: Files/Canto/Cumulus
Caused by: java.lang.ClassNotFoundException: Files.Canto.Cumulus

This is a different error. It means that Java cannot find the class named Cumulus in the package Files.Canto.

Is your class really in a package named Files.Canto? (What does the package ...; statement at the top of your source file look like?)
Jonathan Caldwell
Greenhorn

Joined: Aug 30, 2012
Posts: 21
No the class I am referencing is in a package called com.canto.cumulus I think. or is that the base class?


I have just been using "default package" in my eclipse project, that's a bad idea?


Jonathan Caldwell
Greenhorn

Joined: Aug 30, 2012
Posts: 21
I have really only been using eclipse as an error checker, and I have been building my ejp files using ant from command line. I know eclipse will do a lot of work for me, but I like to know whats going on. my end goal for this is to have an executable JAR file to run this first bit of code that generates some text files. maybe I can set my PATH(s) inside an xml file and do all of this outside eclipse?

IDKWTD

Thanks
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14273
    
  21

How are you running the program? From the command line, from Eclipse, or from a batch file? What is the exact command that is used to run the program?
Jonathan Caldwell
Greenhorn

Joined: Aug 30, 2012
Posts: 21
from eclipse:

Run>Run as...>Java application


from command line:

javac TESTER.java
java TESTER.java

Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Jonathan Caldwell wrote:
java TESTER.java



That's wrong. Assuming you have TESTER.class in your current directory, and assuming you didn't declare a package for your TESTER class (should really be Tester, by the way, to follow the convention), you would doo



You need to give the class name, not the .java file name and not the .class file name.
Jonathan Caldwell
Greenhorn

Joined: Aug 30, 2012
Posts: 21
Sorry, I am getting more lost.

It seems that I will have to set the Path every time before I run the program?
(if I use command line)


theoretically; if I could get eclipse to run the program, it would store that program's specific path?


also if I plan to export to an executable JAR how do I bring all of these other JAR files into the new all encompassing JAR?

(I know that eclipse has options for this, but I mean otherwise)


Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Jonathan Caldwell wrote:Sorry, I am getting more lost.

It seems that I will have to set the Path every time before I run the program?
(if I use command line)


In general it's a good idea to set any environment variables or other startup options each time you start each application, rather than relying on some global setting. That way applications can be configured and run independently of each other and in different environments. Often this is done with a small batch or shell script that launches the app.
Jonathan Caldwell
Greenhorn

Joined: Aug 30, 2012
Posts: 21
okay now I see part of the problem. it is saying Files/Canto/Cumulus

because I told it to go to "Program Files/Canto/Cumulus" it doesn't like the space.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14273
    
  21

Put the path with the space in it in double quotes.

Note: The java command, to run a Java program, wants a classname, not a file name / path as its argument.

If your program is in the default package (you don't have a package statement in it), and it's in C:\Program Files\Canto, then you need to put that directory in the classpath. Don't forget the -Djava.library.path=... if it needs to load the native library. The command would then be something like:

java -classpath "C:\Program Files\Canto" -Djava.library.path=C:\dir\that\contains\the\library Canto
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Confusing UnsatisfiedLinkError