Return-Path: Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 88441 invoked from network); 5 Jul 2000 20:31:35 -0000 Received: from mail.netaxs.com (mail@207.8.186.26) by locus.apache.org with SMTP; 5 Jul 2000 20:31:35 -0000 Received: from [207.8.207.67] (ppp67.blackbox1-mfs.netaxs.com [207.8.207.67]) by mail.netaxs.com (8.8.7/8.8.5) with ESMTP id QAA05001 for ; Wed, 5 Jul 2000 16:31:32 -0400 (EDT) X-Sender: russgold@pop3.netaxs.com Message-Id: In-Reply-To: <3.0.5.32.20000705123338.0087f180@latcs4.cs.latrobe.edu.au> References: <85256913.000D9292.00@d54mta04.raleigh.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Wed, 5 Jul 2000 14:37:05 -0400 To: ant-dev@jakarta.apache.org From: Russell Gold Subject: Re: Working Directory Woes ... or Not ? X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N 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= =20 >"java.class.path") and also some internal paths inside the program.=20 > >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,= =20 ------------------------------------------------------------------------ Russell Gold | "... society is tradition and order russgold@acm.org (preferred) | and reverence, not a series of cheap russgold@netaxs.com | bargains between selfish interests." rgold@thesycamoregroup.com | - Poul Anderson, "Iron"