我想使用Apache Batik从SVG导出PDF文件。我尝试以下代码时遇到错误:
private void buttonperformed(java.awt.event.actionEvent evt) {
try {
TranscoderInput transcoderInput = new TranscoderInput
(new FileInputStream(new File("/Users/Decd/Desktop/input.svg")));
TranscoderOutput transcoderOutput = new TranscoderOutput
(new FileOutputStream(new File("/Users/Decd/Desktop/output.pdf")));
transcoder.transcode(transcoderInput, transcoderOutput);
} catch (FileNotFoundException | TranscoderException ex) {
Logger.getLogger(ChartFrame.class.getName()).log(Level.SEVERE, null, ex);
}
}
同时,这是错误消息:
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/apache/commons/io/DirectoryWalker
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
有什么方法可以解决我的问题吗?