Skip to Main Content

Java HotSpot Virtual Machine

Erro with JNI & ImageMagick

843829Sep 8 2010 — edited Sep 11 2010
Hello community.

Sorry for my English, I live in Brazil and my native language is Brazilian Portuguese (pt-br). :-P

I'm trying to use ImageMagick on project in Netbeans. I'm following the tutorial itself JMagick that has the following code: http://sourceforge.net/apps/mediawiki/jmagick/index.php?title=Reading_images

My code is here:
package metadados.exemplos;
import magick.ImageInfo;
import magick.MagickException;
import magick.MagickImage;
public class Readi {
static{
System.out.println(System.getProperty ("java.library.path"));
//        System.setProperty("java.library.path", System.getProperty ("java.library.path")+":/usr/local/lib:/usr/local/include/");
//        System.out.println(System.getProperty ("java.library.path"));
System.loadLibrary("JMagick");
}
public static void main(String[] a) throws MagickException{
//        System.out.println(System.getProperty ("java.library.path"));
//        MagickImage image = new MagickImage(new ImageInfo("/home/paulopatto/Imagens/PATTO/bandeira_brasil.jpg"));
//        System.out.println(image.getImageFormat());
}
}
And when running this code returns me the following exception:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no JMagick in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1734)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
at univesp.metadados.exemplos.Readi.(Readi.java:12)
Could not find the main class: metadados.exemplos.Readi.  Program will exit.
But as can be seen the the output from System.getProperty ("java.library.path") returns this path:


Vajam And how is my output with the command ls /usr/lib/J*
/usr/lib/JMagick.so
the jar JMagick is in my classpath.

I saw here in the other forum posts about this error but no response or incomplete. I'm using the Ubuntu operating system 10.04 and Java 1.6 (JDK 1.6.0_20 SUN)

Other thing that the load library does not work even with the folder where the JMagick.so is to be part of java.library.path .




Anyone have any suggestions on how to solve this problem?



Thank you atention.

Paulo Patto
web developer
paulopatto gmail [dot] com
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 9 2010
Added on Sep 8 2010
8 comments
1,931 views