views:

32

answers:

2

Hi all

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 guid me.

A: 

According to this tutorial:

  • You need to set LD_LIBRARY_PATH (on Linux/Unix) or PATH (Windows) include the directory where the libraries are.
  • You don't need the .dll suffix.
Bruno
Sir! I use windows. I want to add this, perhaps via IDEA to my project.
sajad
Sorry, I should have said that `PATH` is for Windows (read the link I gave).
Bruno
A: 

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");
The Elite Gentleman
Yes! I deleted file name at the end of System.loadLibrary("C:\..."). but still it doesn't work. How can I add all library to my project? I also used "System.load(filename)" but still error :jvlc.dll: Can't find dependent libraries
sajad
See my updated post....
The Elite Gentleman
@sajad you need to find the libraries upon which your libraries depend and load them first.
Bruno