Closed Frank-99 closed 10 months ago
Throws this Exception:
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: io/sf/carte/doc/style/css/nsac/Parser at io.sf.carte.echosvg.anim.dom.SAXSVGDocumentFactory.<init>(SAXSVGDocumentFactory.java:79) at io.sf.carte.echosvg.anim.dom.SAXSVGDocumentFactory.<init>(SAXSVGDocumentFactory.java:68)
This means that CSS4J is not in your classpath. What are you using to manage dependencies? If it is Gradle or Maven, it should put CSS4J automatically in your classpath or modulepath.
SAXSVGDocumentFactory
belongs to echosvg-anim
, which declares a dependency on echosvg-svg-dom
:
And echosvg-svg-dom
depends on echosvg-dom
:
which declares a dependency on echosvg-css
:
That one carries the CSS4J dependency:
All of the dependency chain is transitive, so if you are managing your classpath correctly you should have CSS4J. If your project is modular, similar considerations apply (just look at the relevant module-info
files).
If you are more familiar with Maven, you can look at the relevant POM files here:
https://css4j.github.io/maven/io/sf/carte/echosvg-anim/1.0/echosvg-anim-1.0.pom https://css4j.github.io/maven/io/sf/carte/echosvg-svg-dom/1.0/echosvg-svg-dom-1.0.pom https://css4j.github.io/maven/io/sf/carte/echosvg-dom/1.0/echosvg-dom-1.0.pom
it's Ant actually... not to the latest standards I know, but it's what I'm using for this project unfortunately
it's Ant actually
All you have to do is to add a dependency on css4j and you'll be fine (latest version is 4.2.1). Although if you are managing your classpath manually, one alternative that you have is to build a Uber Jar with all the dependencies:
https://github.com/css4j/echosvg/wiki/Uber-Jar
But my advice would be to migrate to Gradle as soon as you can.
It's a planned migration but it won't happen soon unfortunately...
I've added the css4j jars but now I get this error
java.lang.NoClassDefFoundError: io/sf/carte/doc/xml/dtd/DefaultEntityResolver
I imagine I also need to include xml-dtd also?
I imagine I also need to include xml-dtd also?
Yes you have to. EchoSVG's DOM uses it to prevent security vulnerabilities while allowing XML entities in the documents (Batik silently erases non-predefined XML entities).
Latest version is 4.2.1.
I added those errors to the FAQ:
amazing, thank you
Hi, I'm getting lost here...
This line of code
Throws this Exception:
I tried setting it to null also, as suggested here but no luck. Do I need to make my own
XMLReader
? how can I go about doing so? Or am I just missing something else?