Thanks for your suggestions!
Just to confirm my understanding of your suggestion, I tried out the
following:
// Start of example class
import java.io.*;
import java.util.*;
public class PropTest2
{
public static void main (String args[])
{
File libDir = null;
try {
libDir = new File(
System.getProperty("java.home") +
File.separatorChar + "lib");
}
catch (SecurityException e) {
System.out.println("SecurityManager prevents access to system
properties.");
return;
}
File propFile = new File(libDir, args[0]);
System.out.println("Expecting properties in: "+propFile.getPath());
Properties p = new Properties();
try {
p.load(new FileInputStream(propFile));
}
catch (Exception e) {
System.out.println(e.toString());
return;
}
p.list(System.out);
}
}
// End of example class
This works, but I was wondering if there was anyway to access the host
platform's environment variables, not just those of the JVM (with a few
vendor-specific properties)? I had a look around the System and Runtime
classes in java.lang, but didn't see any obvious way of getting at them.
This might be a bit "cleaner", or simpler for an administrator with little
knowledge of Java, because -- for a start -- it's not always obvious which
JVM is used by a web app container (yes, I know it's possible to find out,
but the whole point of this thread is to simplify deployment).
I had also thought about using the webapp's server's lib dir, as you
suggested, but wasn't sure of a way to construct server-independent
pathnames towards the "lib" folder of the server.
As for your classpath suggestion, do you mean reading the classpath system
property ("java.class.path"), then looking in each path in the list for the
specified file?
Other than that... which address do you believe would be most effective for
whining to Sun...?
In any case, thanks for your suggestions. Much appreciated!
-Chris
----- Original Message -----
From: "Joseph Ottinger" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 07, 2001 3:09 PM
Subject: Re: Deploying a web app as a war file then supplying init params
> Simplest way: whine and moan at Sun to put in deployment-level environment
> variables.
>
> Real way: use property files, and put your custom properties in the
> classpath. (i.e., in the application lib dir, or the application server
lib
> dir, or even higher, if you like.)
>
>
> >From: chris brown <[EMAIL PROTECTED]>
> >Reply-To: A mailing list about Java Server Pages specification and
> >reference <[EMAIL PROTECTED]>
> >To: [EMAIL PROTECTED]
> >Subject: Deploying a web app as a war file then supplying init params
> >Date: Thu, 7 Jun 2001 10:46:58 +0200
> >
> >Hello,
> >
> >I'm developing a web app which I plan to deploy on several systems. I'm
> >trying to avoid hard-coding anything into the app, so for example
database
> >connections, log file paths, etc. are specified as init-params on the
> >appropriate servlets.
> >
> >When I deploy this as a "war" file (web archive), I'd like it if the
> >administrator of the system where it's being deployed can modify the init
> >params WITHOUT unarchiving / decompressing the archive (especially I need
> >to
> >sign or otherwise encrypt the archive). If not, how else can I design an
> >app so that it's portable and easy to deploy?
> >
> >Thanks,
> >Chris
> >
>
>===========================================================================
> >To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> >JSP-INTEREST".
> >For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> >DIGEST".
> >Some relevant FAQs on JSP/Servlets can be found at:
> >
> > http://java.sun.com/products/jsp/faq.html
> > http://www.esperanto.org.nz/jsp/jspfaq.html
> > http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> > http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets