How to use JVLC (Java bindings for VLC)?
Asked Answered
T

4

1

I'm trying to use JVLC but I can't seem to get it work. I've downloaded the jar, I installed VLC and passed the -D argument to the JVM telling it where VLC is installed. I also tried:

NativeLibrary.addSearchPath("libvlc", "C:\\Program Files\\VideoLAN\\VLC");

with no luck. I always get:

Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'libvlc': The specified module could not be found.

Has anyone made it work?

Tortious answered 24/9, 2008 at 14:41 Comment(1)
A better alternative these days would be VLCJ: code.google.com/p/vlcj The JVLC project is pretty much dead, and VLCJ has long surpassed it.Pitapat
I
1

You can get that exception if the dll you are trying to load requires other dlls that are not available. Sorry I can't be of more specific help, but it is something to check out. You can use depends to walk the dll dependancies.

Indiscrete answered 24/9, 2008 at 14:44 Comment(0)
S
1

Not sure about that NativeLibrary class. Typically when using native libraries, you need to set the system property, "java.library.path", to the location of your native libraries. As suggested, if your native library (dll, so, etc) depends on additional native libraries then the OS will takeover to resolve these dependencies. The OS will have no clue about java.library.path and beging by searching the OS specific path for native libraries. On windows this includes the current PATH environment variable as well as System32 in the windows directory. On linux this is the LD_LIBRARY_PATH / ld.conf setup.

Try setting the PATH (LD_LIBRARY_PATH) to point to the same location as java.library.path. The only catch is that you can't set this one your process launches (the JVM), it's already too late. You need to have the environment set BEFORE the JVM launches. You can do this vis batch files, shell scripts, Ant, or directly from your IDE.

Sunnisunnite answered 24/9, 2008 at 16:29 Comment(0)
F
1

I had the same problem too and I noticed that it occured only with 64-bit jdk/jre. Works like charm with 32-bit jdk under Win7 x64.

Have a nice coding!

-Sipe

Ferree answered 28/3, 2011 at 12:54 Comment(0)
T
1

You should try

System.load("C:\\Path\\To\\libvlc.dll");

at least to verify that your library can be loaded. And if not, it may give you useful error messages (it did for me).

(And as Sipe mentioned, you may be using a 64 bits JRE/JDK, in which case libvlc will never be found (it's 32 bits only). In this case you must switch to using a 32 bits JRE/JDK.)

Tegucigalpa answered 8/5, 2011 at 10:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.