I've been working on the same problem for the past ~4 days: getting JAssimp to work (an Assimp port for Java). Before I ask this question, if ANYONE has got this to work and can provide any files, please do. I am so tired of messing with this.
Anyways, I've compiled two .dlls: jassimp.dll and assimp.dll (jassimp needs assimp.dll to work).
I've placed those in my project directory, and tried to run the project (obviously linking with jassimp.jar, built with ANT)
I get an error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: D:\VB2013Projects\jassimpfinal\Debug\jassimp.dll: The specified procedure could not be found
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1937)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1855)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at jassimp.Jassimp.<clinit>(Unknown Source)
at opengltutorials.Mesh.loadMesh(Mesh.java:131)
at opengltutorials.Tutorial.init(Tutorial.java:124)
at opengltutorials.Tutorial.main(Tutorial.java:238)
I checked the dependencies using dependency walker, and jassimp.dll shows like this:
What's happening here, and how can I fix this?
Related
I've compiled the JAssimp library, and I'm trying to use the library in NetBeans with a project.
I'm setting the library path in Netbeans in the 'run' options of the project as such:
-Djava.library.path=D:\VB2013Projects\jassimpfinal\x64\Debug
That path is where jassimp.dll is located.
However, when I try to run my project, I get this error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: D:\VB2013Projects\jassimpfinal\x64\Debug\jassimp.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1929)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1847)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1119)
at jassimp.Jassimp.<clinit>(Unknown Source)
at opengltutorials.Mesh.loadMesh(Mesh.java:131)
at opengltutorials.Tutorial.init(Tutorial.java:124)
at opengltutorials.Tutorial.main(Tutorial.java:238)
I've checked the dependencies with Dependency Walker, and it shows that
Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module. for jassimp.dll. However, it doesn't show any functions in red, so I think this is just a red herring (I am probably wrong, though).
What's going wrong with this?
Fixed this by putting the appropriate .dll's in the working directory.
Before anyone states duplicate. Please be aware that other questions are windows based and complain about DLLs or are not related to this library.
I have downloaded the EOCFI JAVA API from ESA which I would like to use. These include some example .java files.
I'm simply loading their entire API directory, adding the external JARs, and trying to run their examples. But I run into the following error:
java.lang.UnsatisfiedLinkError: no JCfiLib in java.library.path
I can't seem to find JCfiLib anywhere in the API or on the internet. I would imagine if I could I would simply add it to the java library path as the error states, but I have no idea what it is or where I can get it.
How can I get around this error?
I'm using eclipse on Debian Wheezy.
Any help would be greatly appreciated. Please be patient I'm not a Java programmer.
UPDATE (more details)
I realize now JCfiLib stands for "Java CFI Library" it's the library i'm using. But when I download it it's made up of 7 separate .jar files. (Visibility.jar, Pointing.jar, etc...) I reference them all as external jars.
The line it throws an error on is modelId = new ModelId(); (VisibilityExample.java:221)
error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no JCfiLib 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 EECFI.CfiId.<clinit>(CfiId.java:22)
at Visibility.example.VisibilityExample.main(VisibilityExample.java:211)
There are some native library (including a libJCfiLib.so) in the package I downloaded (linux64, in libraries/LINUX64) and you need to tell Eclipse where to find them:
see How to add native library to "java.library.path" with Eclipse launch (instead of overriding it) for example.
Also note that there are some sample provided in the package with "run script", you can also check those in order to help you with your project.
Hope that helps.
I'm trying to run ParSeMiS. According to the documentation, it requires ant, prefuse and antlr jars to be available in its lib directory. I've put all the required jars in it. However, when I try to run it, I get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: antlr/TokenStreamException
at de.parsemis.miner.environment.Settings.parseFileName(Settings.java:198)
at de.parsemis.miner.environment.Settings.parseOption(Settings.java:312)
at de.parsemis.miner.environment.Settings.parse(Settings.java:170)
at de.parsemis.miner.environment.Settings.parse(Settings.java:122)
at de.parsemis.Miner.run(Miner.java:358)
at de.parsemis.Miner.main(Miner.java:61)
Caused by: java.lang.ClassNotFoundException: antlr.TokenStreamException
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 6 more
Now, I've verified that antlr/TokenStreamException.class is present in the antlr jar. I have tried adding the jar manually to the classpath by both exporting the CLASSPATH variable and setting it via the -cp switch. However, none of that works, and I still get this exception. Can anybody help me figure out what's wrong? Thanks.
The problem is that you're using -jar which ignores your CLASSPATH environment variable. You should list your dependencies in the manifest, as shown here, e.g.
Class-Path: lib/ant.jar lib/antlr-3.4-complete.jar lib/prefuse.jar
(It should have still worked with an explicit -cp option, however. My guess is that you got something wrong when specifying that, and assumed it was the same underlying cause as the failure when using the environment variable.)
I realize this question is very old, but I just had exactly the same problem and found this thread. For posterity, I'm posting how I did eventually get it to run:
As mentioned above, when running with -jar, java apparently ignores the class path. So don't run it with -jar. instead include the jars in the path and run the class directly. Poking around, the following should work (paths are on my Ubuntu 12.10 system):
java -cp /usr/share/java/antlr.jar:/full/path/to/parsemis.jar de.parsemis.Miner
You can then pass in options to the above. Maye sure you use full paths, and no shortcuts like ~/foo, as they apparently don't expand.
Of course, if you're using a Dot-formatted graph like I am, it dies very early on complaining of "unexpected char 0xA", but at least it gets further.
I am using javax.mail .jar file to read the mail messages. But when i m running the code i am getting the following exception.
I added mail.jar in classpath.
Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/MessagingE
xception
Caused by: java.lang.ClassNotFoundException: javax.mail.MessagingException
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)
Could not find the main class: MasterProcess. Program will exit.
any suggetionsn to solve this issue please ...
You're not getting a MessagingException, the VM is complaining that it can't find MessagingException (although it's probably that it's looking for it because it wants to throw it, but those are issues for later).
Check if your mail.jar actually contains this class, and check if your mail.jar really is on the classpath.
The last thing that could happen is that the class is incompatible with your version of Java. Classes compiled for 1.5 won't run on 1.4, for example.
Working in eclipse and not in command line clearly say that there is multiple versions of mail jar present in the project.
Ex:
You have 3 Jars , Jar X, Jar Y and Jar Z.
With out you knowing JAR X might be already be bundled inside JAR Z ( in this case mail jar but some different version.
So what is the problem in having multiple version of same jar ?
You have two different versions and you will not know which will be referenced in your project. (so if you are looking for some class from mail-2.jar in your project you will get class not found exception if the reference is made to mail-1.jar by class loader)
So how come its working properly on Eclipse ?
In eclipse you can see there is an option for ORDER the library, these will be reference in the same order, but while running in command prompt we used to load the as lib/* which loads all to gather and we will not know which lib will get loaded first.
How to identify the culprit and fix the issue ?
Option 1 :
See docs page / user guide of the libs you are using to see what they have in them.
Option 2 :
In eclipse move the JAR in question (mail.jar here) to TOP in the class path order. (your program should work now)
Now bring down the order one by one to see where you get the error. (if you wish to find the jar which is causing this issue , duplicate reference)
Extract the jar which has the duplicate reference remove the duplicate inside the JAR and repackage it. (if required)
Also be sure you're having also the java activation.jar jar.
Are you by any chance working with an App Server (eg. Jboss), if so, just check classloading model (in jboss with single classloading model you may be loading a not so up-to-date version of the jars)
I've also faced the same error. It happens to me that while compiling i used the jars correctly. While running it on command line i noticed the mail.jar (javamail API) was not included.
I'm developing a eclipse plugin rcp and I'm running into a NoClassDefFoundError
Exception in thread "Thread-7" java.lang.NoClassDefFoundError: org/jdom/input/SAXBuilder
at org.geonames.WebService.search(WebService.java:783)
at geo.GeocoderGeonames$SearchThread.run(GeocoderGeonames.java:119)
Caused by: java.lang.ClassNotFoundException: org.jdom.input.SAXBuilder
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:483)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:399)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:387)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:87)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 2 more
The class that supposedly cannot be found is in a jar that I have added to the buildpath. I don't get any compile error etc only this exception when the running application enters the code where this class is needed...
Is there some other place I need to add the jar
After reading this added the jar to the MANIFEST.MF, which solved the problem.
As I understand it, eclipse starts several classloaders which only sees what MANIFEST.MF tells them to see and ingnores the build path...
How are you running your plug-in? You may need to add the JAR to the class path in the VM arguments.
In our experience a NoClassDefFoundError can sometimes mean that more than one version of a Class are found, as there is also a ClassNotFoundException that's normally thrown if a class cannot be found.
Another reason in your case (XML parser) might be something with endorsed classes. Are you directly importing the jdom classes or something like org.w3c...? If so, have a look at the "endorsed classes" system of Java, something that I just recently came across.