ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Louis Tribble <louis.trib...@metamata.com>
Subject Re: Working Directory Woes ... or Not ?
Date Wed, 05 Jul 2000 23:16:56 GMT
Russell Gold wrote:
> 
> At 5:00 PM -0400 7/5/00, Louis Tribble wrote:
> >> 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.
> >
> >Some comments:
> >
> >1. Doing this with user.dir is effectively using system properties
> >as a global constant pool (three whacks with a ruler).
> 
> But isn't that what system properties are???

I guess I should have said global _variable_ pool :-) I guess
my chief objection is a design one. It's a weak typing rather
than strong typing, and its implicit dependency rather than
explicit dependency.

When redefined from the command line, I have less objection,
by the way. My main reservation in that case is that I know
of no requirement that the VM or native code honor it.

> I think it is likely that changing the property on the fly is not guaranteed to be safe;
however, it should always be safe to establish it on the java command line:
> 
>     java -Duser.dir="/my/proper/directory" ProgramWhichCares
> 
> as this setting will happen before any code copies it. The chief benefit of this would
be to eliminate the need for the platform-specific batch files when starting a forked java
task.  This should work in any version of the JDK.
> 
> ------------------------------------------------------------------------
> 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"

-- 

<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Louis Tribble                                         louis@metamata.com
Metamata, Inc.                                   http://www.metamata.com
Tools for serious Java developers.                       +1 510 796 0915
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>

Mime
View raw message