I am trying to run a face recognition project which uses opencv and its contrib function.
I have imported the opencv_342.jar as user libraries. and give the native library location to the folder where all the dll files are.
It is still program giving error of
Exception in thread "main" java.lang.UnsatisfiedLinkError: D:\opencv_build\bin\libopencv_java342.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at com.demo.HelloWorld.main(HelloWorld.java:9)
I don't know why It is unable to find other libraries which dll files are in bin folder
I'm working on Face Recognition Project by using OpenCV 2.4.9, JavaCV 0.7,JAVA version 8 and Eclipse IDE... I am getting these Exceptions continuously.. Is there something wrong in the follwoing code? It's not my complette code...
Please Someone help me as soon as possible...
import com.googlecode.javacpp.Loader;
import com.googlecode.javacv.cpp.opencv_objdetect;
Loader.load(opencv_objdetect.class);
Exceptions:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniopencv_objdetect 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 com.googlecode.javacpp.Loader.loadLibrary(Loader.java:711)
at com.googlecode.javacpp.Loader.load(Loader.java:586)
at com.googlecode.javacpp.Loader.load(Loader.java:540)
at com.googlecode.javacv.cpp.opencv_objdetect.<clinit>(opencv_objdetect.java:91)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.googlecode.javacpp.Loader.load(Loader.java:561)
at FaceRecognizer.<init>(FaceRecognizer.java:56)
at FaceRecognizer.main(FaceRecognizer.java:112)
Caused by: java.lang.UnsatisfiedLinkError: C:\Users\XYX\AppData\Local\Temp\javacpp183187286948746\jniopencv_objdetect.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.load0(Unknown Source)
at java.lang.System.load(Unknown Source)
at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:700)
... 8 more
This page gives a description of how to get an OpenCV Java sample running. There should be two things that you need to do:
You need to call System.LoadLibrary specifying the OpenCV DLLs that it uses
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
Make sure the DLL in somewhere where it can be found by the JVM. There are a few ways if doing that. I don't use Eclipse but this seems to give a good explanation. Alternatively, a simple bodge just to get things working is to drop the DLL into the windows\system32 directory
Finally there may be an issue if you are running a 64 bit JVM but trying to use a 32 bit DLL. If you are still having trouble make sure you are using matching JVM and DLL.
It looks like one of the java libraries that you are using in your project is using jni calls that uses dll files. Do you have the library installed correctly? It looks like it is called opencv or something that is related to jniopencv_objdetect.dll
I'm created a .jar of my java application, and when i'm try to run that .jar from cmd, i get an error.
I've been searching and found many examples, but no one work's for me.
I set the java.library.path to the directory ‘sqljdbc_auth.dll’ like I saw here but the error continuous.
http://www.linglom.com/images/howto/netbeans/sqlserver/part3/8.png
I Run my java application with command : java -Djava.library.path= "my dll path" and give this:
PS C:\Users\User> java -Djava.library.path="C:\Users\User\Desktop\Microsoft JDBC Driver 4.0 for SQL Server\sqljdbc
_4.0\ptb\auth\x64"
Error: Could not find or load main class .library.path=C:\Users\User\Desktop\Microsoft JDBC Driver 4.0 for SQL Server
\sqljdbc_4.0\ptb\auth\x64
I really dont no how solve this.
I've been searching a lot of time, but nothing works. Please someone help me.
THANKS
WARNING: Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java.library.path
com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrat
ectionId:0481a2ee-4ac4-4fd3-89cd-58aad1696fe4
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.j
at com.microsoft.sqlserver.jdbc.AuthenticationJNI.<init>(AuthenticationJNI.java:60)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:
at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(SQLServerConnection.
at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServe
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnect
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnecti
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.jav
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at test.database.Conection.getConexao(Conection.java:41)
at test.forms.jTLogin.<init>(jTLogin.java:71)
at test.forms.jTLogin$4.run(jTLogin.java:448)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$400(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.UnsatisfiedLinkError: no sqljdbc_auth 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 com.microsoft.sqlserver.jdbc.AuthenticationJNI.<clinit>(AuthenticationJNI.java:3
... 28 more
Got it working...
1) Added .dll and .jar in Java/JDK/bin
2) Added .jar in applications/lib
3) Added .dll in windows/system32
add the java/jdk../bin and windows/system32 in "Path" system environment.
If you don't need "integrated security" you can just turn it off with parameter in url:
integratedSecurity=false;
This should be fine for development but probably also for some production environment.
After a full morning of frustration, I finally got it working, all I needed to do was part of #user3320956's first suggestion.
I added the sqljdbc_auth.dll to my JDK\bin directory (in my case C:\Program Files\Java\jdk1.7.0_79\bin) and the only thing in my CLASSPATH is
C:\Program Files\Microsoft JDBC Driver 4.1 for SQL Server\sqljdbc_4.1\enu\sqljdbc41.jar
After that, as long as I didn't use the -cp or -classpath variables I was able to use this statement in my class:
import com.microsoft.sqlserver.jdbc.*;
and connect to a remote database. Here's my connection string (of course, replace SERVERNAME and DBNAME, make sure you have rights, make sure your server is setup to accept TCP/IP connections, etc.):
jdbc:sqlserver://SERVERNAME;database=DBNAME;integratedSecurity=true;authenticationScheme=NativeAuthentication;
HTH!
Cheers,
-Matthew
I was having same issue as OP, but I have not been able to resolve based on user3320956's response.
I'm using Intellij Idea, and I found that I was able to resolve this by changing the method from which I created the .jar. The "extract to target JAR" method was what I previously used and gave me the exact same issue described by OP. I have since changed this method to"try copy to the output directory and link via manifest" method when creating Jar" and I am no longer receiving the error "Error: Could not find or load main class".
Hope this helps save people stuck in my situation a few headaches!
make sure both msssql driver version and jdbcauth version both are same.
I am using gradle, it solved by adding these two lines.
compile group: 'com.microsoft.sqlserver', name: 'mssql-jdbc', version: '8.2.0.jre8'
compile group: 'com.microsoft.sqlserver', name: 'mssql-jdbc_auth', version: '8.2.0.x64'
and add metadatasource:
maven {
url "https://repo.maven.apache.org/maven2"
metadataSources{
mavenPom()
artifact()
}
}
I have made a application to grab video from a webcam and detect motion using OpenCV and JavaCV. I am trying to export as an executable jar using eclipse. The program runs fine in eclipse as does the exe jar on the computer I coded the program on.
What I am trying to accomplish is to make the exe Jar run on computers that don't have OpenCV installed. Basically what I would consider a portable application. When I run the exe jar on a different computer that has nothing installed other than the JRE I get unsatisfied link errors seen below.
Exception in thread "Video Thread" java.lang.UnsatisfiedLinkError: C:\Users\JohnD\AppData\Local\Temp\javacpp91062429652918\jniopencv_core.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(Unknown Source)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.load0(Unknown Source)
at java.lang.System.load(Unknown Source)
at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:566)
at com.googlecode.javacpp.Loader.load(Loader.java:489)
at com.googlecode.javacpp.Loader.load(Loader.java:431)
at com.googlecode.javacv.cpp.opencv_core.<clinit>(opencv_core.java:136)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.googlecode.javacpp.Loader.load(Loader.java:453)
at com.googlecode.javacv.cpp.opencv_imgproc.<clinit>(opencv_imgproc.java:97)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.googlecode.javacpp.Loader.load(Loader.java:453)
at com.googlecode.javacv.cpp.opencv_highgui.<clinit>(opencv_highgui.java:85)
at com.googlecode.javacv.OpenCVFrameGrabber.start(OpenCVFrameGrabber.java:174)
at VideoPanel.run(VideoPanel.java:163)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.UnsatisfiedLinkError: no opencv_core244 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 com.googlecode.javacpp.Loader.loadLibrary(Loader.java:593)
at com.googlecode.javacpp.Loader.load(Loader.java:481)
... 13 more
I have looked for a solution to what I am doing wrong. Most of the topics I have come across with unsatisfied link errors like the ones I am receiving have been trying to get it to run the first time through within there IDE, which is not the case here. I would think my dependencies are correct in the libraries in the build path since I can get it to run perfectly when I am on the computer that has everything installed but I still believe I am doing something wrong with the build.
Again I am trying to make it so the Jar can run on computers where OpenCV/JavaCV is not installed. Any help would be greatly appreciated.
If opencv is not installed in the target machine, than you need to deliver the necessary opencv's dll file and set the corresponding library path, opencv is a precondition of javacv
for example:
jar yourapp.jar -Djava.library.path="/path/to/OpenCV/library"
also check this answer
I have an application that uses JNI for some native functions that are in a DLL. The application runs correctly on windows XP, however when I run the program on Window 2000, I receive the following:
java.lang.UnsatisfiedLinkError: C:\Program Files\Compunetix\stixDlls\CMSCI Dll.d
ll: The specified procedure could not be found
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.load0(Unknown Source)
at java.lang.System.load(Unknown Source)
at com.compunetix.vsd.stix.main.Main.main(Main.java:165)
Any ideas?
Thanks
it might be that the dll uses another dll that is not available in that second machine. Use Dependency walker/ to find exactly what dll is missing.