title: ImageMagick: Im4Java Running from eclipse from MacBook is showing the exception
body: <p>I'm trying to run im4java to compare the images but I'm getting the below exception message. </p>
  
  <p>I have followed the steps to add ImageMagick as in this link: <a href="https://www.imagemagick.org/script/download.php#macosx" rel="nofollow noreferrer">https://www.imagemagick.org/script/download.php#macosx</a></p>
  
  <p>I was getting the same error so, I added the environmental variable in the run configurations of my eclipse as: </p>
  
  <p>DYLD_LIBRARY_PATH=/Users/siva/Downloads/ImageMagick-7.0.5/lib and started running but still i'm getting the same error message:</p>
  
  <p>I also tried: </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code> System.setProperty("java.library.path", "/Users/siva/Downloads/ImageMagick-7.0.5/bin/magick");</code></pre>
  </div>
  </div>
  </p>
  
  <p>If anyone has tried using imageMagick on Mac please suggest me what are the steps I have to do.</p>
  
  <p>I was able to run the below command from the terminal successfully: 
  compare imageone.png imagetwo.png diffimage.png </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>import java.io.IOException;
  import java.math.BigDecimal;
  import java.util.ArrayList;
  
  import org.apache.commons.lang.StringUtils;
  import org.im4java.core.IM4JavaException;
  import org.im4java.core.IMOperation;
  import org.im4java.core.ImageMagickCmd;
  import org.im4java.core.Info;
  import org.im4java.process.ArrayListOutputConsumer;
  
  public class UseImageM {
   private static final String COMPARE_COMMAND = "compare";
   private static final String ABSOLUTE_ERROR = "AE";
  
   private static String imageOnePath = "/Users/siva/Documents/imageEclipse/UsingImagemagick/screenshot.png";
   private static String imageTwoPath = "/Users/siva/Documents/imageEclipse/UsingImagemagick/screenshotfinal.png";
   private static String outputImageName = "outputoftheimageCompare";
   private static final int COUNT_OF_DECIMAL = 10;
  
   public static void main(String[] args) {
    IMOperation imOperation = new IMOperation();
    imOperation.metric(ABSOLUTE_ERROR);
    imOperation.addImage(imageOnePath);
    imOperation.addImage(imageTwoPath);
    imOperation.addImage(outputImageName);
  
    ImageMagickCmd compare = new ImageMagickCmd(COMPARE_COMMAND);
    ArrayListOutputConsumer outputConsumer = new ArrayListOutputConsumer();
    compare.setOutputConsumer(outputConsumer);
    BigDecimal diffPercentage = BigDecimal.ZERO;
  
    Info imageInfo;
    long imageSize = 0;
    try {
     imageInfo = new Info(imageTwoPath, true);
  
     imageSize = imageInfo.getImageWidth() * imageInfo.getImageHeight();
  
     compare.run(imOperation);
  
     final ArrayList&lt;String&gt; errorText = compare.getErrorText();
     if (errorText.size() == 1) {
      final BigDecimal diffCount = new BigDecimal(errorText.get(0));
      if (!BigDecimal.ZERO.equals(diffCount)) {
       diffPercentage = diffCount.divide(
         new BigDecimal(imageSize), COUNT_OF_DECIMAL,
         BigDecimal.ROUND_DOWN);
      }
     }
    } catch (final IOException | InterruptedException e) {
     System.out.println((String.format(
       "Exception happened in comparison between %s and %s.",
       imageOnePath, imageTwoPath) + e));
  
    } catch (final IM4JavaException e) {
     e.printStackTrace();
  
     // error message
     if (!StringUtils.isNumeric(compare.getErrorText().get(0))) {
      final String errorMsg = String.format(
        "Exception happened in comparison between %s and %s.",
        imageOnePath, imageTwoPath);
      System.out.println(errorMsg + e);
  
     }
  
     final BigDecimal diffCount = new BigDecimal(compare.getErrorText()
       .get(0));
     diffPercentage = diffCount.divide(new BigDecimal(imageSize),
       COUNT_OF_DECIMAL, BigDecimal.ROUND_DOWN);
    }
  
    System.out.println(diffPercentage);
  
   }
  
  }
  
  
  Console Logs:
  
  org.im4java.core.InfoException: org.im4java.core.CommandException: java.io.IOException: Cannot run program "identify": error=2, No such file or directory
   at org.im4java.core.Info.getBaseInfo(Info.java:360)
   at org.im4java.core.Info.&lt;init&gt;(Info.java:151)
   at UseImageM.main(UseImageM.java:36)
  Caused by: org.im4java.core.CommandException: java.io.IOException: Cannot run program "identify": error=2, No such file or directory
   at org.im4java.core.ImageCommand.run(ImageCommand.java:219)
   at org.im4java.core.Info.getBaseInfo(Info.java:342)
   ... 2 more
  Caused by: java.io.IOException: Cannot run program "identify": error=2, No such file or directory
   at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
   at org.im4java.process.ProcessStarter.startProcess(ProcessStarter.java:407)
   at org.im4java.process.ProcessStarter.run(ProcessStarter.java:312)
   at org.im4java.core.ImageCommand.run(ImageCommand.java:215)
   ... 3 more
  Caused by: java.io.IOException: error=2, No such file or directory
   at java.lang.UNIXProcess.forkAndExec(Native Method)
   at java.lang.UNIXProcess.&lt;init&gt;(UNIXProcess.java:247)
   at java.lang.ProcessImpl.start(ProcessImpl.java:134)
   at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
   ... 6 more
  Exception in thread "main" java.lang.NullPointerException
   at UseImageM.main(UseImageM.java:60)</code></pre>
  </div>
  </div>
  </p>