0

I have properly installed imagemagick and jmagick and i can convert the below code simple code in terminal by using below command

java -cp .:/home/user/6.4.0/classes/ JmagickImageResizer convert.jpg desc.jpg

import magick.ImageInfo;
import magick.MagickImage;

public class JmagickImageResizer {
    public static void main(String args[]){
    try{
        //System.out.println("java.library.path is: " + System.getProperty("java.library.path"));
        ImageInfo origInfo = new ImageInfo(args[0]); //load image info
        MagickImage image = new MagickImage(origInfo);
        image = image.scaleImage(500, 500);
        image.setFileName(args[1]); //give new location
        image.writeImage(origInfo);
        }catch (Exception e) {
            e.printStackTrace();
        }
    }
}

But when i tried the same code inside my application(which runs in tomcat),I have got the below exception while try to resize the image using Jmagick.

Caused by: java.lang.UnsatisfiedLinkError: magick.Magick.init()V
    at magick.Magick.init(Native Method)
    at magick.Magick.<clinit>(Magick.java:40)
    at com.test.ImageResizer.resizeImage(ImageResizer.java:57)

P.S: java.library.path has been set in the ~/.bash_profile file.

Any Idea to resolve this issue?

Querier
  • 185
  • 1
  • 1
  • 10
  • 1
    https://www.ibm.com/developerworks/community/blogs/738b7897-cd38-4f24-9f05-48dd69116837/entry/debugging_java_lang_unsatisfiedlinkerror9?lang=en – kosa Aug 22 '16 at 14:41
  • Actually i had jmagick-6.4.0.jar in two places. when i removed from the application lib, it took from /usr/local/lib folder and working fine. – Querier Aug 22 '16 at 14:55

0 Answers0