I trying to load SFmpq.dll via this code
static {
Native.setProtected(true);
System.setProperty("jna.library.path",
new File("lib").getAbsolutePath());
System.out.println(System.getProperty("jna.library.path"));
INSTANCE = (SFmpq) Native.loadLibrary("SFmpq", SFmpq.class);
}
It gets executed, Folder and File exist but I still get this error:
C:\Users\Frotty\Documents\NetBeansProjects\Optimizer\lib Exception in
thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: Unable to
load library 'SFmpq': The specified module could not be found.
I gave the code and .dll a friend of mine who imported it into Eclipse and there it worked perfectly fine.
Can anyone spot my mistake or how do I import .dlls correctly?
You can get this error if you try to load a 32 bit library on a 64 bit system.
I've had success with using System.load(...) and System.loadLibrary(..) to load dlls
Related
I am trying to run an example from the JVST library, and I get:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no
jvst-0.0.1 in java.library.path or on the classpath
I made sure that jvst-0.0.1.dll is in the same directory as the class that loads the file (compiled class, not source code), and in fact I tried even copying it in any directory of the project, but still it won't find it. Anybody has an idea why?
Thanks, Simone
EDIT: Solved, it turns out that JVST loads a 32 bits dll, and that won't work if your jdk is 64 bits. The tricky part was that the error message was changed, and it appeared as if the dll was not found.
When i'm trying to load the .so file from the Java, i'm getting error like this.
Exception in thread "main" java.lang.UnsatisfiedLinkError: no yeslib.so in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1681)
at java.lang.Runtime.loadLibrary0(Runtime.java:840)
at java.lang.System.loadLibrary(System.java:1047)
at com.rct.micros.util.GetCustClass.getScratchCode(GetCustClass.java:76)
at com.rct.micros.util.GetCustClass.main(GetCustClass.java:39)
I have tried System.load(absoulte path) and System.loadLibrary(sofilename). Both are giving the same error. When i copy this so file into usr/lib/jvm package, it is working..
can anyone help how to get this solved using Java. i'm running on linux box.
It's possible that the library is on your path, but it can't be loaded for some other reason.
A trick I've used to debug problems like this is to run java -Xrunsofilename
-Xrun is the JVM option to load JVMPI libraries (the old profiling interface). If it succeeds, it will load the library and complain that it's not an agent library. But if it fails (hopefully!) it will print an error message. This is usually a more descriptive error message than what you get from the UnsatisfiedLinkError.
I'm trying to run an internal web browser using JWebBrowser. When I run the application in Netbeans environment it works perfectly. However, when I build the project and run the jar file I'm getting the following error:
NativeSwing[1]: Exception in thread "main" java.lang.UnsatisfiedLinkError: Could
not load SWT library. Reasons:
NativeSwing[1]: no swt-gtk-3721 in java.library.path
NativeSwing[1]: no swt-gtk in java.library.path
NativeSwing[1]: Can't load library: C:\Users\CCS.swt\lib\win32\amd64\swt-gtk-3721.dll
NativeSwing[1]: Can't load library: C:\Users\CCS.swt\lib\win32\amd64\swt-gtk.dll
I'm including the following libraries to the project:
DJNativeSwing.jar
DJNativeSwing-SWT.jar
DJNativeSwing-SWTAPI.jar
DJNativeSwing-SWTCore.jar
MozillaInterfaces-1.8.1.3.jar
swt.jar (version 3.7M5 for 64 bits.)
jna_WindowUtils.jar
jna-3.2.4.jar
and they're referenced by Manifest.MF by this way
Class-Path: lib/DJNativeSwing-SWT.jar lib/DJNativeSwing-SWTAPI.jar lib
/DJNativeSwing-SWTCore.jar lib/MozillaInterfaces-1.8.1.3.jar lib/DJNa
tiveSwing.jar lib/swt.jar lib/jna-3.2.4.jar lib/jna_WindowUtils.jar
What am I doing wrong?
Thank you.
You need to specify the java.library.path in the java command and aim it at the path to your .dll files. For example,
java -Djava.library.path=lib -cp ...
Ok, I found the solution. The problem was about the dll generation. I was using 3.7m5 version, I downloaded a previous version (3.7) and the application ran properly.
Thank you for your help.
Regards.
I am attempting to get SimpleARToolKit in the Processing.org IDE on my Mac. I have downloaded the SimpleARToolKit and JMyron files. I was getting some JMyron errors, but I moved the Library files and now those errors have gone away. The problem I am having now is when I try to run demo01.pde from the SimpleARToolKit, I get an error that says:
UnsatisfiedLinkError: no JARToolKit in java.library.path Exception in
thread "Animation Thread" java.lang.UnsatisfiedLinkError: no
JARToolKit in java.library.path at
java.lang.ClassLoader.loadLibrary(ClassLoader.java:1754) at
java.lang.Runtime.loadLibrary0(Runtime.java:823) at
java.lang.System.loadLibrary(System.java:1045) at
net.sourceforge.jartoolkit.core.JARToolKit.(JARToolKit.java:40)
at pARToolKit.SimpleARToolKit.(SimpleARToolKit.java:36) at
demo01.setup(demo01.java:44) at
processing.core.PApplet.handleDraw(PApplet.java:1608) at
processing.core.PApplet.run(PApplet.java:1530) at
java.lang.Thread.run(Thread.java:680)
The demo is crashing on this line:
ar = new SimpleARToolKit(this, capWidth, capHeight);
I have found a few other websites that seem to be asking the same question, but none of them are in English and through using Google Translate, none of them seem to resolve the issue.
Update:
This is not yet resolved but I have an update:
I found jARToolKit on SourceForge.net
Inside the jARToolKit.zip folder I found jARToolKit.jar file and copied it to my Mac/Library/Java/Extensions/ folder
Now when I run the code, the error says "no jartoolkit in java.library.path" (note the lowercase "jartoolkit") - as opposed to the original "no JARToolKit in java.library.path". If I remove the .jar file from the Extensions folder, the original error appears again, so this makes me think that I am on the right track, but still missing something.
Hi guys
I've some problems with my project compilation and run.
My Java project (called BioTesi) tries to load a library called BioCpp.dll, ma it doesn't succeed. I am usin' Eclipse.
What could it be?
Sounds like the DLL is not on the PATH if you're using Windows.
http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jni.html