简体   繁体   English

如何在我的Java项目中完全包含Batik库?

[英]How do I fully include the Batik library in my Java project?

I am trying to add the Batik library to my Java project. 我正在尝试将Batik库添加到我的Java项目中。 I added the unzipped binary to my lib folder, and added all of the JARs in the top level to the build path. 我将解压缩后的二进制文件添加到我的lib文件夹中,并将顶级中的所有JAR都添加到了构建路径中。

在此处输入图片说明

在此处输入图片说明

However, when I make the following import statement: 但是,当我进行以下import语句时:

import org.apache.batik.dom.svg.SAXSVGDocumentFactory; I get the following error: 我收到以下错误:

"The import org.apache.batik.dom.svg.SAXSVGDocumentFactory cannot be resolved" “无法解析导入的org.apache.batik.dom.svg.SAXSVGDocumentFactory”

Other import statements do not exhibit this problem, such as the following: 其他导入语句不会出现此问题,例如:

import org.apache.batik.util.XMLResourceDescriptor;

As far as I understand, the SAXSVGDocumentFactory class exist somewhere in the binary I added to the lib folder, so the issue must be with adding JARs to the build path. 据我了解, SAXSVGDocumentFactory类存在于我添加到lib文件夹中的二进制文件中的某个位置,因此问题肯定出在将JAR添加到构建路径中。 How can I make sure that all of the Batik source files are added to the build path correctly and are usable? 我如何确保所有的Batik源文件都已正确添加到构建路径并可用?

It cannot be resolved because it doesn't present in 1.8 jar. 无法解决,因为它不在1.8 jar中。 It exists in 1.7. 它存在于1.7中。 http://www.findjar.com/class/org/apache/batik/dom/svg/SAXSVGDocumentFactory.html http://www.findjar.com/class/org/apache/batik/dom/svg/SAXSVGDocumentFactory.html

The easy way to find this out is to find the right jar and click to open it by the package: org.apache.batik.dom.svg.SAXSVGDocumentFactory. 找出此错误的简单方法是找到正确的jar,然后单击以下文件以将其打开:org.apache.batik.dom.svg.SAXSVGDocumentFactory。 You wont see this class in 1.8 jar, but you will see it in 1.7 jar. 您不会在1.8 jar中看到该类,但会在1.7 jar中看到它。

To fix, download a 1.7 jar and add it to your project again. 要解决此问题,请下载1.7 jar,然后将其再次添加到您的项目中。 http://apache.mirrors.hoobly.com/xmlgraphics/batik/source/ http://apache.mirrors.hoobly.com/xmlgraphics/batik/source/

If somebody can't find SAXSVGDocumentFactory after updating Batik in legacy project, just change the import: 如果在旧项目中更新Batik后找不到某人SAXSVGDocumentFactory,只需更改导入:

import org.apache.batik.dom.svg.SAXSVGDocumentFactory;

with

import org.apache.batik.anim.dom.SAXSVGDocumentFactory;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM