This is something that Robert and I have lamanted often. The problem is that java.library.path can only locate the FIRST shared library to load. If that library then loads other shared libraries, it will look for those dependencies in a PATH/LD_LIBRARY_PATH specified set of locations. Worse, on most operating systems, the search-path it searches is set at process start time and cannot be modified by the running process (ugh).
For example it turns out that xuggle-xuggler.jar loads (via Java) libxuggle-xuggler-2.dll, which in turn loads (via the OS) libxuggle-xuggler-io-2.dll, libavcodec-?.dll, libavformat-?.dll, libavutil-?.dll and libswscale-?.dll. These in turn load (via the OS) libmp3lame-0.dll, libspeex-0.dll and libfaad-?.dll. Normally "java.library.path" will only find the first dll (libxuggle-xuggler-2.dll) and all the rest will be searched for by the OS. So we need to have people install a native component first.
There is a potential way around this in Microsoft Windows; in theory we could put all DLLs into the JAR file directly because (I believe) Windows will look for a DLL first in that path of the loading DLL, and if not found will only then search the PATH variable. Unfortunately this convention does not work on other operating systems (Mac, and the N-different flavors of Linux). Worse, what versions of which .so and .dylib files should we include in the jar file for those systems? And what about 32-bit versus 64-bit versions? And what happens to the size of our JAR file?
Another thing we considered is creating one bill DLL for all Xuggler and dependencies but this has the effect of (a) meaning LGPL builds of Xuggler are impossible, (b) has known issues with linking non-DLL versions of FFMPEG on Microsoft Windows and (c) removes the ability for people to use their own version of ffmpeg with Xuggler (which is really the same as (a)).
The fact is Xuggle has a native component and always will in the future, and because of this issue we require setting up the PATH/LD_LIBRARY_PATH variables (it's worth nothing that all other similar JNI products -- Sun's JMF, JFFMPEG, FobS, etc -- all have the same restriction). To make things a little easier, we actually make setting "java.library.path" optional -- if you don't set it (as most people do seem to forget to) we'll search PATH, LD_LIBRARY_PATH or DYLD_LIBRARY_PATH for you.
I hope that answers your question. I am open to approaches that work around this problem that keep current levels of functionality but make it easier for web deployment -- the problem is I haven't heard of any.
- Art
--
http://www.xuggle.com/xu‧ggle (zŭ' gl) v. To freely encode, decode, and experience audio and video.
Use Xuggle to get the power of FFMPEG in Java.