Reputation: 2174
I am trying to add and use a program called JVLC to my program. I downloaded a zip file that contains a jar file(jvlc.jar) for java interface and 2 dll files (jvlc.dll , libvlc.dll) and a folder that contains many dll files. when I run my program an UnsatisfiedLinkError occurs. I used this code to add those 2 dll files to my project.
System.loadLibrary("C:\\Users\\sajad\\Documents\\Downloads\\Compressed\\JVLC\\jvlc.dll");
System.loadLibrary("C:\\Users\\sajad\\Documents\\Downloads\\Compressed\\JVLC\\libvlc.dll");
but still there is error:
UnsatisfiedLinkError: Directory separator should not appear in library name
Is it necessary to add all folder to library paths? If yes how?
please guide me.
Upvotes: 3
Views: 12094
Reputation: 89179
The System.loadLibrary
method loads a libary based on a library name (libName, without extension) and not through file name. Example, Java comes with a zip.dll / zip.so (Linux) that is used when we use the Zip Deflater/Inflater classes for zip files.
If you want to use specify a dll file name, use the System.load(String filename)
method otherwise, register your DLL in a java lib path.
An example can be found here.
For your example, please do this:
//Your code....
System.loadLibrary("C:\\Users\\sajad\\Documents\\Downloads\\Compressed\\JVLC\\jvlc.dll");
System.loadLibrary("C:\\Users\\sajad\\Documents\\Downloads\\Compressed\\JVLC\\libvlc.dll");
//Replace with this...
System.load("C:\\Users\\sajad\\Documents\\Downloads\\Compressed\\JVLC\\jvlc.dll");
System.load("C:\\Users\\sajad\\Documents\\Downloads\\Compressed\\JVLC\\libvlc.dll");
Upvotes: 6
Reputation: 122719
According to this tutorial:
LD_LIBRARY_PATH
(on Linux/Unix) or PATH
(Windows) include the directory where the libraries are..dll
suffix.Upvotes: 0