You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Seem <si...@gmx.de> on 2008/12/11 16:47:19 UTC

access files inside AAR - File Path! not Resource / URL

I have an unsolved problem accessing a file which is inside my aar-folder.
Unfortunately I need a file Path for a 3rd Party function and not a Resource
or an URL. Do you have any advices how to get the right path to the file?

My folder structure is like this

/META-INF
/bin (Service classes)
/conf/config.xml



-- 
View this message in context: http://www.nabble.com/access-files-inside-AAR---File-Path%21-not-Resource---URL-tp20958031p20958031.html
Sent from the Axis - User mailing list archive at Nabble.com.


Re: access files inside AAR - File Path! not Resource / URL

Posted by Seem <si...@gmx.de>.
I still have problems to access my resources.

Is it necessary to add the additional folders inside my .aar explicitely to
the classpath?



Seem wrote:
> 
> Just to clarify, I have a similar problem like this:
> http://www.nabble.com/Accessing-a-file-in-AAR-to16787898.html#a16898376
> 
> but I do not understand his mentioned solution.
> 
> Should I use the getResourceAsStream(), create a temporary file from the
> inputstream, get the file path und use it with my 3rd party methods?
> 
> 
> 
> 
> 
> Deepal Jayasinghe wrote:
>> 
>> 
>>> Yes, I tried this, but there is still the problem, that I need a file
>>> Path
>>> and not a resource/URL to invoke File file = new File(file Path) for
>>> further
>>> operations.
>>>
>>> and this was not a solution to get the correct Path:
>>> getClass().getClassLoader().getResource("conf/config.xml").getPath();
>>>
>>>
>>> if(!file.exists()) {...system.out
>>>   
>> I do not think you can do something like this,
>> What you can do is get the input stream and read it and do your job.
>> 
>> If you get not-null value for getResource(), then that is mean you can
>> access your resource.
>> 
>> Thank you!
>> Deepal
>>> brought me this:
>>> cannot find file
>>> file:/C:/Programme/Tomcat/work/Catalina/localhost/axis2/_axis2/axis230466Service.aar!/conf/config.xml
>>>
>>>
>>>
>>>
>>>
>>> Deepal Jayasinghe wrote:
>>>   
>>>> Have a look at following article, which provides a way to access your
>>>> resources inside the service archive file.
>>>>
>>>> http://wso2.org/library/259
>>>>
>>>> Deepal
>>>>     
>>>>> I have an unsolved problem accessing a file which is inside my
>>>>> aar-folder.
>>>>> Unfortunately I need a file Path for a 3rd Party function and not a
>>>>> Resource
>>>>> or an URL. Do you have any advices how to get the right path to the
>>>>> file?
>>>>>
>>>>> My folder structure is like this
>>>>>
>>>>> /META-INF
>>>>> /bin (Service classes)
>>>>> /conf/config.xml
>>>>>
>>>>>
>>>>>
>>>>>   
>>>>>       
>>>> -- 
>>>> Thank you!
>>>>
>>>>
>>>> http://blogs.deepal.org
>>>>
>>>>
>>>>
>>>>     
>>>
>>>   
>> 
>> -- 
>> Thank you!
>> 
>> 
>> http://blogs.deepal.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/access-files-inside-AAR---File-Path%21-not-Resource---URL-tp20958031p20978881.html
Sent from the Axis - User mailing list archive at Nabble.com.


Re: access files inside AAR - File Path! not Resource / URL

Posted by Seem <si...@gmx.de>.
Just to clarify, I have a similar problem like this:
http://www.nabble.com/Accessing-a-file-in-AAR-to16787898.html#a16898376

but I do not understand his mentioned solution.

Should I use the getResourceAsStream(), create a temporary file from the
inputstream, get the file path und use it with my 3rd party methods?





Deepal Jayasinghe wrote:
> 
> 
>> Yes, I tried this, but there is still the problem, that I need a file
>> Path
>> and not a resource/URL to invoke File file = new File(file Path) for
>> further
>> operations.
>>
>> and this was not a solution to get the correct Path:
>> getClass().getClassLoader().getResource("conf/config.xml").getPath();
>>
>>
>> if(!file.exists()) {...system.out
>>   
> I do not think you can do something like this,
> What you can do is get the input stream and read it and do your job.
> 
> If you get not-null value for getResource(), then that is mean you can
> access your resource.
> 
> Thank you!
> Deepal
>> brought me this:
>> cannot find file
>> file:/C:/Programme/Tomcat/work/Catalina/localhost/axis2/_axis2/axis230466Service.aar!/conf/config.xml
>>
>>
>>
>>
>>
>> Deepal Jayasinghe wrote:
>>   
>>> Have a look at following article, which provides a way to access your
>>> resources inside the service archive file.
>>>
>>> http://wso2.org/library/259
>>>
>>> Deepal
>>>     
>>>> I have an unsolved problem accessing a file which is inside my
>>>> aar-folder.
>>>> Unfortunately I need a file Path for a 3rd Party function and not a
>>>> Resource
>>>> or an URL. Do you have any advices how to get the right path to the
>>>> file?
>>>>
>>>> My folder structure is like this
>>>>
>>>> /META-INF
>>>> /bin (Service classes)
>>>> /conf/config.xml
>>>>
>>>>
>>>>
>>>>   
>>>>       
>>> -- 
>>> Thank you!
>>>
>>>
>>> http://blogs.deepal.org
>>>
>>>
>>>
>>>     
>>
>>   
> 
> -- 
> Thank you!
> 
> 
> http://blogs.deepal.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/access-files-inside-AAR---File-Path%21-not-Resource---URL-tp20958031p20959233.html
Sent from the Axis - User mailing list archive at Nabble.com.


Re: access files inside AAR - File Path! not Resource / URL

Posted by Deepal Jayasinghe <de...@opensource.lk>.
> Yes, I tried this, but there is still the problem, that I need a file Path
> and not a resource/URL to invoke File file = new File(file Path) for further
> operations.
>
> and this was not a solution to get the correct Path:
> getClass().getClassLoader().getResource("conf/config.xml").getPath();
>
>
> if(!file.exists()) {...system.out
>   
I do not think you can do something like this,
What you can do is get the input stream and read it and do your job.

If you get not-null value for getResource(), then that is mean you can
access your resource.

Thank you!
Deepal
> brought me this:
> cannot find file
> file:/C:/Programme/Tomcat/work/Catalina/localhost/axis2/_axis2/axis230466Service.aar!/conf/config.xml
>
>
>
>
>
> Deepal Jayasinghe wrote:
>   
>> Have a look at following article, which provides a way to access your
>> resources inside the service archive file.
>>
>> http://wso2.org/library/259
>>
>> Deepal
>>     
>>> I have an unsolved problem accessing a file which is inside my
>>> aar-folder.
>>> Unfortunately I need a file Path for a 3rd Party function and not a
>>> Resource
>>> or an URL. Do you have any advices how to get the right path to the file?
>>>
>>> My folder structure is like this
>>>
>>> /META-INF
>>> /bin (Service classes)
>>> /conf/config.xml
>>>
>>>
>>>
>>>   
>>>       
>> -- 
>> Thank you!
>>
>>
>> http://blogs.deepal.org
>>
>>
>>
>>     
>
>   

-- 
Thank you!


http://blogs.deepal.org


Re: access files inside AAR - File Path! not Resource / URL

Posted by Seem <si...@gmx.de>.
Yes, I tried this, but there is still the problem, that I need a file Path
and not a resource/URL to invoke File file = new File(file Path) for further
operations.

and this was not a solution to get the correct Path:
getClass().getClassLoader().getResource("conf/config.xml").getPath();


if(!file.exists()) {...system.out

brought me this:
cannot find file
file:/C:/Programme/Tomcat/work/Catalina/localhost/axis2/_axis2/axis230466Service.aar!/conf/config.xml





Deepal Jayasinghe wrote:
> 
> Have a look at following article, which provides a way to access your
> resources inside the service archive file.
> 
> http://wso2.org/library/259
> 
> Deepal
>> I have an unsolved problem accessing a file which is inside my
>> aar-folder.
>> Unfortunately I need a file Path for a 3rd Party function and not a
>> Resource
>> or an URL. Do you have any advices how to get the right path to the file?
>>
>> My folder structure is like this
>>
>> /META-INF
>> /bin (Service classes)
>> /conf/config.xml
>>
>>
>>
>>   
> 
> -- 
> Thank you!
> 
> 
> http://blogs.deepal.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/access-files-inside-AAR---File-Path%21-not-Resource---URL-tp20958031p20958833.html
Sent from the Axis - User mailing list archive at Nabble.com.


Re: access files inside AAR - File Path! not Resource / URL

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Have a look at following article, which provides a way to access your
resources inside the service archive file.

http://wso2.org/library/259

Deepal
> I have an unsolved problem accessing a file which is inside my aar-folder.
> Unfortunately I need a file Path for a 3rd Party function and not a Resource
> or an URL. Do you have any advices how to get the right path to the file?
>
> My folder structure is like this
>
> /META-INF
> /bin (Service classes)
> /conf/config.xml
>
>
>
>   

-- 
Thank you!


http://blogs.deepal.org