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 Luca Piccarreta <lu...@gmail.com> on 2008/02/01 00:13:11 UTC

Re: Trouble running jar with batik.

Hi Kevin, I'm not such an expert, but I can just suggest a couple of ideas
1) Build your own Batik, and use debug information, it might be easier 
to understand
what is going wrong. It's very easy!
2) If nothing can help you.... go for the stupid solution, load with any 
java parser, and
import the root element
3) Post your code

All the best,
Luca.

kgrad5 ha scritto:
> I have tried placing the "/" infront as well as putting in the entire path
> "c:/etc/etc/" using both classloader() and without classloader() and every
> combination i can think of.. nothing seems to be working and i am at a loss. 
>
> every time i try to run the jar, it cannot find the svg file and the loader
> returns null. If you have any other ideas it would be very appreciated.
>
> thanks again,
> -Kevin
>
>
> Archie Cobbs wrote:
>   
>> 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 <ke...@couchware.ca> 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: batik-users-unsubscribe@xmlgraphics.apache.org
>>> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>>>
>>>
>>>       
>> -- 
>> Archie L. Cobbs
>>
>>
>>     
>
>   


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


Re: Trouble running jar with batik.

Posted by kgrad5 <ke...@couchware.ca>.
Hey all, thanks for all the help, we finally got it to work.

It turned out to be a problem with the slashes. we were referencing our .svg
files as
"com"+File.seperator+"blah"+File.seperator+"program"+File.seperator+"file.svg"
when we should have been doing "com/blah/program/file.svg".

Thanks everyone for the input.
-Kevin




Luca Piccarreta wrote:
> 
> Hi Kevin, I'm not such an expert, but I can just suggest a couple of ideas
> 1) Build your own Batik, and use debug information, it might be easier 
> to understand
> what is going wrong. It's very easy!
> 2) If nothing can help you.... go for the stupid solution, load with any 
> java parser, and
> import the root element
> 3) Post your code
> 
> All the best,
> Luca.
> 
> kgrad5 ha scritto:
>> I have tried placing the "/" infront as well as putting in the entire
>> path
>> "c:/etc/etc/" using both classloader() and without classloader() and
>> every
>> combination i can think of.. nothing seems to be working and i am at a
>> loss. 
>>
>> every time i try to run the jar, it cannot find the svg file and the
>> loader
>> returns null. If you have any other ideas it would be very appreciated.
>>
>> thanks again,
>> -Kevin
>>
>>
>> Archie Cobbs wrote:
>>   
>>> 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 <ke...@couchware.ca> 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: batik-users-unsubscribe@xmlgraphics.apache.org
>>>> For additional commands, e-mail:
>>>> batik-users-help@xmlgraphics.apache.org
>>>>
>>>>
>>>>       
>>> -- 
>>> Archie L. Cobbs
>>>
>>>
>>>     
>>
>>   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Trouble-running-jar-with-batik.-tp15189592p15220598.html
Sent from the Batik - Users mailing list archive at Nabble.com.


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