At 10:33 PM -0400 7/4/00, Peter Donald wrote:
>Hi,
>
>Can someone point out where my stupidity lies here :P. I was under the
>impression that working directory was impossible to set in java. However
>recently I have been playing with
>System.setProperty("user.dir","someotherdirectory") and everything seems to
>work !!! hmmm The only problems occured when I used relative paths. So what
>I did at the begining of my program was resolve any relative paths to
>absolute paths. This means you have to resolve some system properties (ie
>"java.class.path") and also some internal paths inside the program.
>
>So all my tests seem to work but I have always been under impression this
>is impossible and have had several knowledgable people preach at me that it
>was impossible. So have I missed something ????
>
>If I haven't missed anything this could be implemented in ant no ? Then we
>would no longer have to set ant home because everything could be done via
>class-loaders and this no ? (Except for rare occasions when need to change
>security manager, connection factory or whatever multiple times for
>different tasks).
My question is: who told you that it was impossible? The only way that Java
knows what its home directory *is* by reading the user.dir property. What you
have done is exactly right and really out to be an easier (and relatively
platform independant) way to implement the "java" task - which in this case
would NOT probably be a subclass of the exec task. Of course,
------------------------------------------------------------------------
Russell Gold | "... society is tradition and order
[EMAIL PROTECTED] (preferred) | and reverence, not a series of cheap
[EMAIL PROTECTED] | bargains between selfish interests."
[EMAIL PROTECTED] | - Poul Anderson, "Iron"