My mistake, getClass().getResource( "/" ); works to get the path to the bin
folder and that was good enough to parse and create the location of my
resouces without an absolute path( dependant on the workspace location in
Eclipse ).
Thanks Henrique.
On 1/29/07 4:02 PM, "Logi Helgu" <log..s.is> wrote:
> That dosn't work when I have a clean Java file that only extends TestCase :(
>
> On 1/26/07 11:19 AM, "Henrique Prange" <hprang..mail.com> wrote:
>
>> Hi Logi,
>>
>> Try
>>
>> getClass().getResource( "/LANGUAGE.lproj/FILE.txt" );
>>
>> or
>>
>> getClass().getResourceAsStream( "/LANGUAGE.lproj/FILE.txt" );
>>
>> The first method returns the URL for your resource and the second
>> returns an InputStream.
>>
>> Cheers,
>>
>> Henrique
>>
>> Logi Helgu wrote:
>>> I have a unit test that needs to get data from a text file in my languge(
>>> lproj ) folder and I'd like to set it up without an absolute path( like
>>> /Developer/workspace/PROJECT/LANGUAGE.lproj/FILE.txt ).
>>>
>>> Since my test case is pure Java I don't have a running Application with the
>>> ResouceManager and I'm using BufferedReader/FileReader with the absolute
>>> path to the file to read its contents.
>>>
>>> Any ideas how I can get the resource in my test case without the absolute
>>> path, since I don't want the test to be dependent on the location of my
>>> workspace.
>>>
>>>
>>>
>>> With well-being and veneration,
>>> Logi Helgu
>>>
>>>
>>>
>>>
>>> Fyrirvari á tölvupósti / e-mail disclaimer
>>> <a
>>> href="http://www.us.is/page/fyrirvari">http://www.us.is/page/fyrirvari>
>>>
>>>
>
>
> Með vegsemd og virðingu,
>
> Logi Helgu
> Umferðarstofa
Með vegsemd og virðingu,
Logi Helgu
Umferðarstofa
Fyrirvari á tölvupósti / e-mail disclaimer
<a href="http://www.us.is/page/fyrirvari">http://www.us.is/page/fyrirvari>
This archive was generated by hypermail 2.0.0 : Tue Jan 30 2007 - 06:33:40 EST