tomcat下用jmagick调用ImageMagick的问题
在网上查到在tomcat下用jmagick调用ImageMagick必须要做到以下3步,
1. Put jmagick.jar in your WEBINF/lib dir
2. Put the following line in an initialization part of your webapp:
//Tell jmagick.magick.Magick to not use the system ClassLoader
System.setProperty("jmagick.systemclassloader","no");
3. make sure the Jmagick.dll and Imagemagick dlls are on the system path
按照以上3步做以后,web程序还是会报错,大致错误是:
java.lang.NoClassDefFoundError: Could not initialize class magick.MagickImage
或者是magick.Magick.init错误。
经过不断的google和测试后,发现还要把jmagick.jar复制到<jdk>/jre/lib/ext下,程序才能正常运行。
environment:
jdk 1.6.0_10; apache-tomcat-6.0.14; ImageMagick-6.2.5-4-Q16-windows-dll; jmagick-6.2.4-1-IM-6.2.5