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
-- --------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
READ THE FAQ!!!! <http://java.apache.org/faq/>
Archives and Other: <http://java.apache.org/main/mail.html/>
Problems?: [EMAIL PROTECTED]