junit and external file [message #257985] |
Tue, 10 June 2008 11:25  |
Eclipse User |
|
|
|
hi all
I have to make junit test with external file in simple
I have to open a file , read some data , (see if there are correct) etc..;
le prob is how to have the same path even if test move to another pc.
my best solution is put that on the jar itself but what is the reltive
path of the current jar??
thanks
a++
|
|
|
|
Re: junit and external file [message #258083 is a reply to message #258014] |
Wed, 11 June 2008 00:58  |
Eclipse User |
|
|
|
Wayne Beaton a écrit :
> YOur first and best choice is to include the file in the JAR and use the
> Class.getResourceAsStream() method to get it. This, however, doesn't
> work so well if you have to write to the file. It does have the benefit
> of working anywhere, including a JAR or bundle.
>
> Another option is to explicitly set the working directory in your launch
> configuration (on the Arguments tab).
>
> HTH,
>
> Wayne
>
> On Tue, 2008-06-10 at 17:25 +0200, julien wrote:
>> hi all
>> I have to make junit test with external file in simple
>> I have to open a file , read some data , (see if there are correct) etc..;
>>
>> le prob is how to have the same path even if test move to another pc.
>> my best solution is put that on the jar itself but what is the reltive
>> path of the current jar??
>>
>> thanks
>>
>> a++
>
thanks,
I ll look
a++
|
|
|
Powered by
FUDForum. Page generated in 0.08627 seconds