3

I am having some trouble setting up my environment in Eclipse for ImageMagick via JMagick in OS X. I have no problems using the ImageMagick command line tools (display, convert, etc.) after installing, but am unable to set up JMagick with a Java project in Eclipse.

Steps taken:

  1. Downloaded JMagick 6.4.0
  2. Generated jar and libs through make process in the INSTALL document
  3. Copied libJMagick.so and libJMagick-6.4.0.so from lib to /usr/lib/java
  4. Added JMagick.jar to build path
  5. Linked /usr/lib/java directory to JMagick.jar native source, recommended in the solution posted by trigoman at the following url: JMagick Error when trying to load a file - UnsatisfiedLink
  6. Created sample class that accesses JMagick and attempted to run in Eclipse. Exception reported:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no JMagick in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1758)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1045)
at example.ImageRender.main(ImageRender.java:10)

Does anyone have any ideas what might be the underlying problem is?

Community
  • 1
  • 1

1 Answers1

3

edit: see my comment below about using im4java instead of JMagick.

I was having the same problem, but just got it working by following these sparse instructions: http://wesleyli.blog.com/2011/09/01/install-jmagick-on-mac/

But note there's a couple typos; looks like Lion auto-correct problems. So what I did was:

svn co https://jmagick.svn.sourceforge.net/svnroot/jmagick jmagick
cd jmagick/trunk
./configure --with-java-home=/System/Library/Frameworks/JavaVM.framework/Versions/Current --with-magick-home=/usr/local/jmagick
sudo make all & sudo make install
sudo ln -s /usr/local/lib/libJMagick-6.5.7.so /Library/Java/Extensions/libJMagick.jnilib

And now it works for me. :)

fith
  • 101
  • 5
  • Great, thanks fith. After building the jnilib with those flags and referencing the native lib in Eclipse, I was able to get it to work. – random_stackoverflow_user Jan 31 '12 at 18:57
  • 2
    No problem. For my own project I just recently switched to im4java, which doesn't use the JNI (poorly supported on Mac), is better / still developed (jmagick hasn't been updated since like 2009 or something), and is available in Maven repositories so I didn't even have to deal with compiling or installing anything myself. I also found the interface more straight forward, and saw some minor performance improvements. Only caveat was having to set a system-wide PATH to ImageMagick executables in environment.plist to get it to work on my Mac dev box. http://im4java.sourceforge.net/ – fith Jun 22 '12 at 23:41
  • @fith Can you help me about how to use im4java in android? – Sanober Malik Feb 15 '13 at 12:00
  • No, I can't, sorry. I've never touched Android. – fith Apr 16 '13 at 03:55