You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Anand B N <an...@learningbyte.com> on 2001/09/06 08:10:36 UTC

User of "catalina.home" property

Can we rely on the fact that catalina.home property will always return a 
valid path(either ".." a.k.a. parent or an absolute path) abd write 
components that will run for Tomcat only based on that property.

Currently I do the following:-

         FileInputStream in ;
         File catalinaHome = new  File(System.getProperty("catalina.home"));
         handlerMap = new HashMap();

         /*
           Load request mapping File descriptor
         */
         in = new 
FileInputStream(catalinaHome.getCanonicalFile()+fileSeparator+"webapps"+fileSeparator+"casadmin"......

I works fine so far but justo find out if it can be relied upon.

Anand


Re: User of "catalina.home" property

Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Thu, 6 Sep 2001, Anand B N wrote:

> Date: Thu, 06 Sep 2001 11:40:36 +0530
> From: Anand B N <an...@learningbyte.com>
> Reply-To: tomcat-dev@jakarta.apache.org
> To: tomcat-dev@jakarta.apache.org
> Subject: User of "catalina.home" property
>
> Can we rely on the fact that catalina.home property will always return a
> valid path(either ".." a.k.a. parent or an absolute path) abd write
> components that will run for Tomcat only based on that property.
>
> Currently I do the following:-
>
>          FileInputStream in ;
>          File catalinaHome = new  File(System.getProperty("catalina.home"));
>          handlerMap = new HashMap();
>
>          /*
>            Load request mapping File descriptor
>          */
>          in = new
> FileInputStream(catalinaHome.getCanonicalFile()+fileSeparator+"webapps"+fileSeparator+"casadmin"......
>
> I works fine so far but justo find out if it can be relied upon.
>
> Anand
>
>

Yes, you can rely on the "catalina.home" property, as long as you are
starting Tomcat with the standard startup scripts.

In addition, a recent nightly build added the new "catalina.base"
property, which defaults to the same place, but can be set different
directory -- this facilitates using the same installed copy of Tomcat 4
for more than one user on the same server.  The "catalina.base" property
is the default base for the "bin", "classes", "common", "jasper", "lib",
and "server" directories (i.e. all the parts of Tomcat 4 that are
constant), while "catalina.home" is the default base for "logs",
"webapps", and "work".

To take advantage of this configuration capability, simply set the
CATALINA_BASE environment variable to where you want "catalina.base" to
point at.  If not set, it defaults to whatever value CATALINA_HOME has
(whether calculated or pre-set).

Craig