让 Image 任务在 Ant 中工作

发布于 2024-11-15 18:15:32 字数 277 浏览 2 评论 0原文

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

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

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

谢谢!

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 the 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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

青衫负雪 2024-11-22 18:15:32

JAR 仅包含 图像任务。您还必须将 JAI 放在您的类路径中。

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

$ 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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文