java batik_java – Batik传递库依赖项

在使用Gradle构建项目并引入Batik 1.8版本时遇到运行时错误,由于缺少org.w3c.dom.ElementTraversal类导致程序无法正常运行。尝试添加xml-api或Xerces库未能解决问题。错误堆栈显示在解析SVG文件时遇到了ClassNotFoundException。
摘要由CSDN通过智能技术生成

我正在使用Gradle来获取Batik(一个SVG库)并开箱即用,它缺少一些传递库.我应该放哪一个?

我已经尝试过获取xml-api或Xerces lib

摇篮:

version = 1.0

mainClassName = 'com.foilen.svgexporter.SvgExporter'

sourceCompatibility = '1.8'

targetCompatibility = '1.8'

dependencies {

compile 'args4j:args4j:2.32'

compile 'org.apache.xmlgraphics:batik-rasterizer:1.8'

}

Java代码:

PNGTranscoder transcoder = new PNGTranscoder();

InputStream in = new FileInputStream("character_man_black.svg");

TranscoderInput input = new TranscoderInput(in);

OutputStream ostream = new FileOutputStream("character_man_black.png");

TranscoderOutput output = new TranscoderOutput(ostream);

transcoder.transcode(input, output);

// Flush and close the output.

o

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值