Search code examples
javaeclipsemacosimagemagickosx-elcapitan

Eclipse not able to load Java ImageMagick library in Mac OS X 10.11.4


I have added the location of ImageMagick binary in .bash_profile as shown below:-

export MAGICK_HOME="$HOME/software/ImageMagick-7.0.1"
launchctl setenv MAGICK_HOME $MAGICK_HOME
export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib/"
launchctl setenv DYLD_LIBRARY_PATH $DYLD_LIBRARY_PATH
export PATH="$MAGICK_HOME/bin:$PATH"

But when ever I am launching my java app on Eclipse I am getting the below error:-

Caused by: java.io.IOException: Cannot run program "identify": error=2, No such file or directory

But whenever I am executing identify from command line it is working:-

jabongs-MacBook-Pro-4:~ debraj$ identify
dyld: Library not loaded: /opt/X11/lib/libpng15.15.dylib
  Referenced from: /Users/debraj/software/ImageMagick-7.0.1/bin/identify
  Reason: image not found
Trace/BPT trap: 5

I have seen this answer and added ProcessStarter.setGlobalSearchPath("/Users/debraj/software/ImageMagick-7.0.1/bin");. But then it started giving error dyld: Library not loaded: /ImageMagick-7.0.1/lib/libMagickCore-7.Q16HDRI.0.dylib

Can some one let me know what is going wrong?


Solution

  • The issue has nothing to do with eclipse. ImageMagick was installed from MacOSX Binary release as mentioned here. This was creating issues.

    After installing ImageMagick as below:-

    brew update
    brew upgrade
    brew install imagemagick
    

    and then setting GlobalSearchPath in my Java app as shown below solved the issue:-

    ProcessStarter.setGlobalSearchPath("/usr/local/bin/");