If you're going to use absolute classpath names like
"resource/animation.svg" then you need to prefix them with a "/" character,
e.g., use "/resource/animation.svg" instead.

See javadocs for Class{Loader}.getResource() for details.

On Jan 31, 2008 12:22 PM, kgrad5 <[EMAIL PROTECTED]> wrote:

>
> Hi Thomas and Archie,
>
> thanks for the responses,
> I tried to change to using getClass().getResource(path);
>
> my directory structure is as follows: i have my main class files in a
> single
> directory with a few sub directories. The subdirectories are tile,
> resource,
> event and animation. Within these subdirectories lie the class files for
> those specific portions of the code. The resource subdirectory holds all
> the
> .svg files.
>
> i changed the path to be "resource/File.svg"
>
>
> I still get the same error when running from the jar, however i now also
> get
> errors when the classes in the subdirectories try to access their svg
> documents. They can no longer find them in the resource directory.
>
> so for example animation/animation.class cannot access
> resource/animation.svg. As well my initial problem is unsolved.
>
> thanks for the help,
>
> - Kevin
>
>
> Thomas Behr-2 wrote:
> >
> > Hi kgrad5,
> >
> > is the URL returned by getResource null or in what way does it not find
> > the svg file? If so, you *need* to adjust path.
> >
> > I find it much more easy to use getClass().getResource(path), because
> > then path has to be relative to the class file.
> >
> > Can you tell us the file hierarchy in your jar for the class file from
> > which you try to resolve the resource and the svg file?
> >
> > Kind regard, Thomas
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Trouble-running-jar-with-batik.-tp15189592p15211568.html
> Sent from the Batik - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Archie L. Cobbs

Reply via email to