head	1.8;
access;
symbols;
locks
	nobody:1.8; strict;
comment	@# @;


1.8
date	99.05.21.23.38.31;	author nobody;	state Exp;
branches;
next	1.7;

1.7
date	99.05.11.18.14.09;	author nobody;	state Exp;
branches;
next	1.6;

1.6
date	99.05.11.17.22.09;	author nobody;	state Exp;
branches;
next	1.5;

1.5
date	99.05.11.17.19.48;	author nobody;	state Exp;
branches;
next	1.4;

1.4
date	99.05.11.17.14.17;	author nobody;	state Exp;
branches;
next	1.3;

1.3
date	99.05.11.17.09.27;	author nobody;	state Exp;
branches;
next	1.2;

1.2
date	99.05.11.17.08.46;	author nobody;	state Exp;
branches;
next	1.1;

1.1
date	99.05.11.17.08.35;	author nobody;	state Exp;
branches;
next	;


desc
@null
@


1.8
log
@null
@
text
@IDependOn-Set: 1
IDependOn-Set: 142
IDependOn-Set: 150
IDependOn-Set: 152
IDependOn-Set: 2
IDependOn-Set: 7
LastModifiedSecs: 927329911
Parent: 7
SequenceNumber: 5
Title: What is the current working directory for Apache JServ?
Part: 0
Author-Set: cmcclanahan@@mytownnet.com
LastModifiedSecs: 926443329
Type: monospaced
Lines: 26
Gregory Krasnow asks:

>If you have...
>    Properties myprops = new Properties();
>    FileInputStream instream = new FileInputStream("xxx.properties");
>    myprops.load(instream);
>
>where should xxx.properties live?  what is considered to be the working
>directory for the JVM?

The answer depends on how you started the Apache JServ servlet engine.  If you
start JServ manually, the working directory is set by the startup script that
you have created.  If you start JServ automatically, the current working
directory will be "/" (at least on Linux systems).

For the particular purpose of loading properties files, I would suggest that
you look at using ResourceBundle.getBundle() instead.  This approach will
load your resources from either a properties file or a Java class that is
located in the same CLASSPATH (i.e. from a directory or a ZIP or JAR file)
that your servlets are loaded from, and you do not have to hard code any
assumptions about paths in your code.

Alternatively, you could pass the pathname to your properties file in an
initialization parameter of the servlet, rather than hard coding it.

Craig McClanahan
EndPart: 0
Part: 1
Author-Set: jon@@working-dogs.com
HideAttributions: 1
LastModifiedSecs: 927329911
Type: monospaced
Lines: 47
----------
From: "Craig R. McClanahan" <cmcclanahan@@mytownnet.com>
To: Java Apache Users <java-apache-users@@list.working-dogs.com>
Subject: Re: Current Working Directory
Date: Fri, May 21, 1999, 4:25 PM

Graeme Wallace wrote:

> Hi,
>
> I'm using 1.0b3 on NT and Solaris. I'm using a static section within a class
> to load up some parameters from a file. I want to place this file
> somewhere that I can pick up independantly from JServ on UNIX or JServ on
> NT, but the current working directory is different on NT than Unix.
>
> NT its in the top level apache directory
> UNIX its in the jserv top level directory.
>
> Is there a reason for this ?
>

Even on Unix, there is no guarantee where the top level directory is, because
you can start JServ manually, and set the current working directory anywhere
you like.

The best approach to this kind of problem is one of the following:

*   Pass the pathname to your initialization file as an initArgs
    parameter to your servlet.

*   If the file contains property settings, it's much easier to
    read them with java.util.ResourceBundle.getBundle().  The
    "resource name" you pass to this call is resolved by the class
    loader used to load your servlet (which is usually from a
    directory or JAR file listed in your zone repository), and this
    will even load a properties file from a JAR file for you.

See examples of the latter in the "Internationalization" documentation of the
JDK documentation bundle.  Even if you don't need the automatic localization
feature, this is really handy for "location independent" loading of static
resources.

>
> Graeme Wallace
>

Craig McClanahan
EndPart: 1
@


1.7
log
@null
@
text
@d7 1
a7 1
LastModifiedSecs: 926443329
d9 1
a9 1
SequenceNumber: 4
d43 54
@


1.6
log
@null
@
text
@d4 1
@


1.5
log
@null
@
text
@d6 1
a6 1
LastModifiedSecs: 926443188
d8 1
a8 1
SequenceNumber: 3
d12 1
a12 1
LastModifiedSecs: 926443188
d14 1
a14 1
Lines: 23
d36 3
@


1.4
log
@null
@
text
@d6 1
a6 1
LastModifiedSecs: 926442857
d8 1
a8 1
SequenceNumber: 2
d12 1
a12 1
LastModifiedSecs: 926442857
d14 1
a14 1
Lines: 22
d33 3
a35 2
located in the same CLASSPATH that your servlets are loaded from, and you
do not have to hard code any assumptions about paths in your code.
@


1.3
log
@null
@
text
@d6 1
a6 1
LastModifiedSecs: 926442567
d8 1
a8 1
SequenceNumber: 1
d10 28
@


1.2
log
@null
@
text
@d6 1
a6 1
LastModifiedSecs: 926442515
d8 2
a9 2
SequenceNumber: 0
Title: New Item
@


1.1
log
@null
@
text
@d2 1
@
