You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Chris Kelly <Ch...@advent-comm.co.uk> on 2001/09/10 11:41:04 UTC

Loading an SVG from a jar file

Hi
 
I'm using the JSVGCanvas from an applet and trying to load an SVG from a jar
file  

In the applet the following lines are used to try and load the SVG
 
          JSVGCanvas svgCanvas = new JSVGCanvas();
 
         URL url=getClass().getResource("/simple.svg");     1 
         System.out.println(url.toString());                          2
         svgCanvas.setURI(url.toString());                           3 
 
Line 2 outputs the following to the plug-in's java console
 
jar:file:/C:/WINNT/Profiles/chrisk/java_plugin_AppletStore/1.3.1/jar/applet.
jar1826258758null-8726020040050372760.jar!/simple.svg
This looks a bit strange to me since I've never seen a jar URL before but
I'm guessing the SVG has been found. Right?
 
Line 3, however, still seems to give me problems (line 3 is
SVGApplication.java:98 below):-
 
Exception occurred during event dispatching:
java.lang.NoClassDefFoundError: org.apache.batik.css.parser.Parser
 at
org.apache.batik.css.CSSDocumentHandler.class$(CSSDocumentHandler.java:35)
 at
org.apache.batik.css.CSSDocumentHandler.<clinit>(CSSDocumentHandler.java:39)
 at
org.apache.batik.dom.svg.SVGDOMImplementation.<init>(SVGDOMImplementation.ja
va:88)
 at
org.apache.batik.dom.svg.SVGDOMImplementation.<clinit>(SVGDOMImplementation.
java:59)
 at
org.apache.batik.dom.svg.SAXSVGDocumentFactory.<init>(SAXSVGDocumentFactory.
java:68)
 at org.apache.batik.bridge.DocumentLoader.<init>(DocumentLoader.java:67)
 at
org.apache.batik.swing.svg.JSVGComponent.loadSVGDocument(JSVGComponent.java:
203)
 at org.apache.batik.swing.JSVGCanvas.setURI(JSVGCanvas.java:354)
 at batik.SVGApplication$2.actionPerformed(SVGApplication.java:98)
 at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
 at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown
Source)
 at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
 at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
 at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
 at java.awt.Component.processMouseEvent(Unknown Source)
 at java.awt.Component.processEvent(Unknown Source)
 at java.awt.Container.processEvent(Unknown Source)
 at java.awt.Component.dispatchEventImpl(Unknown Source)
 at java.awt.Container.dispatchEventImpl(Unknown Source)
 at java.awt.Component.dispatchEvent(Unknown Source)
 at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
 at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
 at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
 at java.awt.Container.dispatchEventImpl(Unknown Source)
 at java.awt.Window.dispatchEventImpl(Unknown Source)
 at java.awt.Component.dispatchEvent(Unknown Source)
 at java.awt.EventQueue.dispatchEvent(Unknown Source)
 at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
 at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
 at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
 at java.awt.EventDispatchThread.run(Unknown Source)

I'm using java 1.3.1 and Batik 1.0
 
I've absolutely no idea what I can do to get around this. Any suggestions?
 
Chris 
This message is intended for the addressee only. It must not be disclosed
to, altered, copied or used by anyone other than the addressee(s). If you
have received this message in error, please notify our email administrator
at   postmaster@advent-comm.co.uk <ma...@advent-comm.co.uk> and
destroy the message, removing it completely from your computer system. 
Thank you for your assistance. 

Mail Virus Warning
-------------------------------

This email and any attachment are believed to be free from viruses which
might affect any system into which they are received or opened, it is the
responsibility of the recipient to ensure that they are virus free.
 Advent Communications ltd accepts no liability whatsoever for any direct,
indirect or consequential loss or damage arising in any way from receipt,
opening or use.


Re: Loading an SVG from a jar file

Posted by Vincent Hardy <vi...@sun.com>.
Chris,



> Chris Kelly wrote:
> 
> This looks a bit strange to me since I've never seen a jar URL before
> but I'm guessing the SVG has been found. Right?

We cannot know with the trace below.

> 
> Line 3, however, still seems to give me problems (line 3 is
> SVGApplication.java:98 below):-
> 
> Exception occurred during event dispatching:
> java.lang.NoClassDefFoundError: org.apache.batik.css.parser.Parser

Right: this means that you do not have
org.apache.batik.css.parser.Parser
in your classpath. My guess is that there are a couple .class files
missing in your applet.jar file. In other words, try to add
org.apache.batik.css to your applet.jar for example and see if you
still have the error.

I hope this helps,
Vincent.

>  at
> org.apache.batik.css.CSSDocumentHandler.class$(CSSDocumentHandler.java:35)
>  at
> org.apache.batik.css.CSSDocumentHandler.<clinit>(CSSDocumentHandler.java:39)
>  at
> org.apache.batik.dom.svg.SVGDOMImplementation.<init>(SVGDOMImplementation.java:88)
>  at
> org.apache.batik.dom.svg.SVGDOMImplementation.<clinit>(SVGDOMImplementation.java:59)
>  at
> org.apache.batik.dom.svg.SAXSVGDocumentFactory.<init>(SAXSVGDocumentFactory.java:68)
>  at
> org.apache.batik.bridge.DocumentLoader.<init>(DocumentLoader.java:67)
>  at
> org.apache.batik.swing.svg.JSVGComponent.loadSVGDocument(JSVGComponent.java:203)
>  at org.apache.batik.swing.JSVGCanvas.setURI(JSVGCanvas.java:354)
>  at batik.SVGApplication$2.actionPerformed(SVGApplication.java:98)
>  at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
>  at
> javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown
> Source)
>  at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
>  at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
>  at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown
> Source)
>  at java.awt.Component.processMouseEvent(Unknown Source)
>  at java.awt.Component.processEvent(Unknown Source)
>  at java.awt.Container.processEvent(Unknown Source)
>  at java.awt.Component.dispatchEventImpl(Unknown Source)
>  at java.awt.Container.dispatchEventImpl(Unknown Source)
>  at java.awt.Component.dispatchEvent(Unknown Source)
>  at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
>  at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
>  at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
>  at java.awt.Container.dispatchEventImpl(Unknown Source)
>  at java.awt.Window.dispatchEventImpl(Unknown Source)
>  at java.awt.Component.dispatchEvent(Unknown Source)
>  at java.awt.EventQueue.dispatchEvent(Unknown Source)
>  at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown
> Source)
>  at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
> Source)
>  at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
>  at java.awt.EventDispatchThread.run(Unknown Source)
> 
> I'm using java 1.3.1 and Batik 1.0
> 
> I've absolutely no idea what I can do to get around this. Any
> suggestions?
> 
> Chris
> 
> This message is intended for the addressee only. It must not be
> disclosed to, altered, copied or used by anyone other than the
> addressee(s). If you have received this message in error, please
> notify our email administrator at postmaster@advent-comm.co.uk and
> destroy the message, removing it completely from your computer system.
> Thank you for your assistance.
> 
> Mail Virus Warning
> -------------------------------
> 
> This email and any attachment are believed to be free from viruses
> which might affect any system into which they are received or opened,
> it is the responsibility of the recipient to ensure that they are
> virus free.
> Advent Communications ltd accepts no liability whatsoever for any
> direct, indirect or consequential loss or damage arising in any way
> from receipt, opening or use.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org