You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Robert Priest <Ro...@bentley.com> on 2003/03/10 15:58:51 UTC

RE: How to get catalina_home variable

CATALINA_HOME is a shell variable (DOS\UNIX, or whatever type of system you
are running on). It is not variable of the JVM that started Tomcat. Now, of
course, you could pass CATALINA_HOME to your JVM. But, the only variables
that System.getProperty will retrieve are the ones of the JVM. To see what
you have available, you could do:

public class getEnv
{

    public getEnv()
    {
    }

    public static void main(String args[])
    {
        Properties properties = System.getProperties();
        Enumeration enumeration = properties.propertyNames();
        if(args.length == 0)
        {
            String s;
            String s1;
            for(; enumeration.hasMoreElements(); System.out.println(s + ":
\t " + s1))
            {
                s = (String)enumeration.nextElement();
                s1 = System.getProperty(s);
            }

        } else
        {
            for(int i = 0; i < args.length; i++)
            {
                String s2 = System.getProperty(args[i]);
                System.out.println(args[i] + ": \t" + s2);
            }

        }
    }
}


-----Original Message-----
From: Raja Sekhar [mailto:alekya_raj2@eudoramail.com]
Sent: Monday, March 10, 2003 9:59 AM
To: tomcat-user@jakarta.apache.org
Subject: How to get catalina_home variable


Hi,

I am using Tomcat 4.0.6. I am writing a JSP in which I want to get the
catalina_home path. I am giving the code as
System.getProperty("CATALINA_HOME"). This is retreving me null.

I am running tomcat using startup.bat. Please help me asap if you have any
suggestions.

Thanks & Regards,

..Raj


Need a new email address that people can remember
Check out the new EudoraMail at
http://www.eudoramail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org