java.lang.UnsatisfiedLinkError: no jniavcodec in java.library.path

1,243 views
Skip to first unread message

Pete Helgren

unread,
Apr 1, 2014, 5:47:04 PM4/1/14
to jav...@googlegroups.com
I have searched for solutions to this issue and even though I thought I correctly followed the solutions, I still get the error.  So here is what I have and what I have tried:

Windows 7 64 bit.  MyEclipse IDE (10.5 which is running Eclipse 3.7.2).  The JRE is 6.0.20 (pretty sure its a 32bit JRE)

I grabbed the ffmpeg-20140401-git-5b03caf-win32-shared file from the Zeranoe website and unzipped to a folder which I added (with bin) to the PATH environment.  I added the following jars to my project in Eclipse:

javacv.jar
javacpp.jar
javacv-windows-x86.jar 
opencv-2.4.8-windows-x86.jar
ffmpeg-2.1.1-windows-x86.jar

The following dll's are in the bin folder on the PATH (as mentioned above):

avcodec-55.dll
avdevice-55.dll
avfilter-4.dll
avformat-55.dll
avutil-52.dll
postproc-52.dll
swresample-0.dll
swscale-2.dll

ffmpeg produces this output at the command line:

ffmpeg version N-62004-g5b03caf Copyright (c) 2000-2014 the FFmpeg developers
  built on Mar 31 2014 22:05:19 with gcc 4.8.2 (GCC)
  configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth
--enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --e
nable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-lib
opencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinge
r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --
enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-
libxavs --enable-libxvid --enable-zlib
  libavutil      52. 70.100 / 52. 70.100
  libavcodec     55. 55.107 / 55. 55.107
  libavformat    55. 36.100 / 55. 36.100
  libavdevice    55. 11.100 / 55. 11.100
  libavfilter     4.  3.100 /  4.  3.100
  libswscale      2.  5.102 /  2.  5.102
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

I used an example posted in this group that concatenates two files together and basically I get the error in the stack trace as soon as I do this:

FrameGrabber intro = new FFmpegFrameGrabber("intro.mp3");

I tried all 64bit dll's and jar's as well with the same result.  So I am missing something.  The dll's are on the PATH.  Do I have to add the jar's to the classpath explicitly?  I am creating and deploying this as a servlet app and I see all the correct jars the WEB-INF\lib folder in Tomcat after I deploy but somehow the dll's aren't being picked up even though they are on the PATH (or so it seems)

What have I missed here?  It seems like it should work.....

Thanks!

Pete Helgren

unread,
Apr 3, 2014, 2:22:26 PM4/3/14
to jav...@googlegroups.com
There were three additional things I did and now I have this working.  I added both vc++ redistributable packages (32 and 64 bit).  I put the entire E:\opencv\build\x86\vc10\bin folder in the PATH.  I removed the jars from webapp\lib in my Eclipse folder and instead added them as external jars in my project.  Everything seems to be working.

Samuel Audet

unread,
Apr 5, 2014, 2:36:47 AM4/5/14
to jav...@googlegroups.com
Hello,

On 04/02/2014 06:47 AM, Pete Helgren wrote:
> I tried all 64bit dll's and jar's as well with the same result. So I am
> missing something. The dll's are on the PATH. Do I have to add the
> jar's to the classpath explicitly? I am creating and deploying this as
> a servlet app and I see all the correct jars the WEB-INF\lib folder in
> Tomcat after I deploy but somehow the dll's aren't being picked up even
> though they are on the PATH (or so it seems)
>
> What have I missed here? It seems like it should work.....

The DLLs in the PATH might be conflicting with the ones in the JAR
files. Have you tried to remove everything from the PATH and only keep
the ones in your CLASSPATH?

And there are funny things that happen with JNI and TomCat:
http://wiki.apache.org/tomcat/HowTo#I.27m_encountering_classloader_problems_when_using_JNI_under_Tomcat

So be sure to try and put everything in /shared/lib instead of just /lib

Samuel

Pete Helgren

unread,
Apr 7, 2014, 10:07:20 AM4/7/14
to jav...@googlegroups.com
Let me me ask a follow up question because it was devilishly difficult to get a definitive guide on how to install on Windows.  Yes, there is a "how to" but then, if it doesn't work, there a many, many links that give what seems to be conflicting information on how to resolve issues, particularly the UnsatisfiedLinkError:

1) There is a "bundle" with installer on the Sourceforge site (I used opencv-2.4.8.exe) is this at all necessary?
2) Is it necessary to have ffmpeg installed and on the path at all?
3) Are the jars that contain the DLL's: (javacv-windows-x86.jar and opencv-2.4.8-windows-x86.jar and ffmpeg-2.1.1-windows-x86.jar) all I need to support the java code?(javacpp.jar, and javacv.jar).  IOW are those 5 jar's all I need? (In this case for a Windows installation running an 32bit JVM?)

I just want to be clear on exactly what is needed because it is really easy to head down rabbit holes chasing the errors....

Thanks




--

--- You received this message because you are subscribed to a topic in the Google Groups "javacv" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/javacv/TLq6wLkpVCc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to javacv+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Samuel Audet

unread,
Apr 12, 2014, 10:07:51 AM4/12/14
to jav...@googlegroups.com
On 04/07/2014 11:07 PM, Pete Helgren wrote:
> Let me me ask a follow up question because it was devilishly difficult
> to get a definitive guide on how to install on Windows. Yes, there is a
> "how to" but then, if it doesn't work, there a many, many links that
> give what seems to be conflicting information on how to resolve issues,
> particularly the UnsatisfiedLinkError:

Yes, I'm sorry about that. It should get easier/clearer when I'm done
with the JavaCPP Presets:
http://code.google.com/p/javacpp/wiki/Presets
It took me a few years just to get that much right ;)

> 1) There is a "bundle" with installer on the Sourceforge site (I
> used opencv-2.4.8.exe) is this at all necessary?

Not if what's in the CPPJARs is good enough for you.

> 2) Is it necessary to have ffmpeg installed and on the path at all?

Same thing, not if CPPJARs suffice.

> 3) Are the jars that contain the DLL's: (javacv-windows-x86.jar and
> opencv-2.4.8-windows-x86.jar and ffmpeg-2.1.1-windows-x86.jar) all I
> need to support the java code?(javacpp.jar, and javacv.jar). IOW are
> those 5 jar's all I need? (In this case for a Windows installation
> running an 32bit JVM?)

Yes, that is all we need, but to maintain maximum portability, these
binaries do not have all features enabled.

> I just want to be clear on exactly what is needed because it is really
> easy to head down rabbit holes chasing the errors....

Fully understand :)

From your next message, I gather that you got everything working
alright, so thanks for the feedback!

Samuel

Pete Helgren

unread,
Apr 12, 2014, 11:13:01 AM4/12/14
to jav...@googlegroups.com
Thanks again Samuel.  I appreciate the clarification and I already posted to someone on this list who had a similar issue (and fixed it) so it reduces your workload (a *tiny* bit).  I got the installation working but not the application.  If you could take a quick look at my post back to you under "Audio file type detection".  I am still having trouble with the app transcoding an merging the files together.
Reply all
Reply to author
Forward
0 new messages