让Image任务在Ant中工作



我正在尝试使用Ant中的Image任务,它需要Java Advanced Imaging。.jar文件似乎在Ant库中,但当我尝试缩放图像时,它会出现以下错误:

Could not load a dependent class javax/media/jai/PlanarImage

ant-jai.jar文件没有这个类是有原因的吗?有没有人有在Ant中使用JAI的经验,或者特别是成功使用Image任务的经验?

谢谢!

JAR只包含在Image task中定义的对象。你也必须把JAI放在你的课堂上。

附录:关于NoClassDefFoundError: javax.media.jai.OperationRegistrySpi,您可以验证类是否在jai_core.jar中,如下所示。追踪这种异常的一种方法是使用java命令的-verbose选项。

$jar tf jai_core.jar | grep OperationRegistrySpijavax/media/jai/OperationRegistrySpi.class$jar tf lib/ant-jai.jarMETA-INF/META-INF/MANIFEST.MForg/org/apache/org/apache/tools/org/apache/tools/ant/org/apache/tools/ant/taskdefs/org/apache/tools/ant/taskdefs/可选/org/apache/tools/ant/taskdefs/可选/image/org/apache/tools/ant/taskdefs/可选/image/image.classorg/apache/tools/ant/types/org/apache/tools/ant/types/optional/org/apache/tools/ant/types/optional/image/org/apache/tools/ant/types/optional/images/Arc.classorg/apache/tools/ant/types/optional/images/BasicShape.classorg/apache/tools/ant/types/optional/images/ColorMapper.classorg/apache/tools/ant/types/optional/images/Draw.classorg/apache/tools/ant/types/optional/images/DrawOperation.classorg/apache/tools/ant/types/optional/images/Ellipse.classorg/apache/tools/ant/types/optional/images/ImageOperation.classorg/apache/tools/ant/types/optional/images/Rectangle.classorg/apache/tools/ant/types/optional/images/Rotate.classorg/apache/tools/ant/types/optional/images/Scale$ProportionsAttribute.classorg/apache/tools/ant/types/optional/images/Scale.classorg/apache/tools/ant/types/optional/images/Text.classorg/apache/tools/ant/types/optional/images/TransformOperation.class

相关内容

  • 没有找到相关文章

最新更新