Getting Image task to work in Ant
I'm trying to utilize the Image task in Ant, which requires Java Advanced Imaging. The .jar file seems to be in the Ant library, but when I try to scale an image, it gives me t开发者_如何学Gohe following error:
Could not load a dependent class javax/media/jai/PlanarImage
Is there a reason why the ant-jai.jar file wouldn't have this class already? Does anyone have experience with using either JAI in Ant, or specifically in using the Image task successfully?
Thanks!
The JAR contains only the objects defined in the Image task
. You'll have to put JAI on your class path, too.
Addendum: Regarding NoClassDefFoundError: javax.media.jai.OperationRegistrySpi
, you might verify that the class is in jai_core.jar
, as shown below. One way to track down such anomalies is to use the -verbose
option of the java
command.
$ jar tf jai_core.jar | grep OperationRegistrySpi javax/media/jai/OperationRegistrySpi.class $ jar tf lib/ant-jai.jar META-INF/ META-INF/MANIFEST.MF org/ org/apache/ org/apache/tools/ org/apache/tools/ant/ org/apache/tools/ant/taskdefs/ org/apache/tools/ant/taskdefs/optional/ org/apache/tools/ant/taskdefs/optional/image/ org/apache/tools/ant/taskdefs/optional/image/Image.class org/apache/tools/ant/types/ org/apache/tools/ant/types/optional/ org/apache/tools/ant/types/optional/image/ org/apache/tools/ant/types/optional/image/Arc.class org/apache/tools/ant/types/optional/image/BasicShape.class org/apache/tools/ant/types/optional/image/ColorMapper.class org/apache/tools/ant/types/optional/image/Draw.class org/apache/tools/ant/types/optional/image/DrawOperation.class org/apache/tools/ant/types/optional/image/Ellipse.class org/apache/tools/ant/types/optional/image/ImageOperation.class org/apache/tools/ant/types/optional/image/Rectangle.class org/apache/tools/ant/types/optional/image/Rotate.class org/apache/tools/ant/types/optional/image/Scale$ProportionsAttribute.class org/apache/tools/ant/types/optional/image/Scale.class org/apache/tools/ant/types/optional/image/Text.class org/apache/tools/ant/types/optional/image/TransformOperation.class
精彩评论