简体   繁体   中英

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

I am trying to add the Batik library to my Java project. I added the unzipped binary to my lib folder, and added all of the JARs in the top level to the build path.

在此处输入图片说明

在此处输入图片说明

However, when I make the following import statement:

import org.apache.batik.dom.svg.SAXSVGDocumentFactory; I get the following error:

"The import org.apache.batik.dom.svg.SAXSVGDocumentFactory cannot be resolved"

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. How can I make sure that all of the Batik source files are added to the build path correctly and are usable?

It cannot be resolved because it doesn't present in 1.8 jar. It exists in 1.7. 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. You wont see this class in 1.8 jar, but you will see it in 1.7 jar.

To fix, download a 1.7 jar and add it to your project again. http://apache.mirrors.hoobly.com/xmlgraphics/batik/source/

If somebody can't find SAXSVGDocumentFactory after updating Batik in legacy project, just change the import:

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

with

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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