Discussion:
Obtain catalina-home variable
maux
2008-05-28 10:35:18 UTC
Permalink
Hi,

I would like to know how can i catch the catalina_home variable in a java
code.

Thanks in advance.
--
View this message in context: http://www.nabble.com/Obtain-catalina-home-variable-tp17509750p17509750.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: ***@tomcat.apache.org
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org
Mark Thomas
2008-05-28 10:54:12 UTC
Permalink
Post by maux
Hi,
I would like to know how can i catch the catalina_home variable in a java
code.
Thanks in advance.
System.getenv()

Mark

---------------------------------------------------------------------
To start a new topic, e-mail: ***@tomcat.apache.org
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org
maux
2008-05-28 14:53:14 UTC
Permalink
Thanks for your help, Mark.

But one more question, with that method i have to add the CATALINA_HOME
variable to the environment variables, don´t I?

I have seen that when you install Tomcat, if you press twice the icon of
Tomcat that appears on the task bar, there is a variable with the route of
Tomcat, can i catch this variable or do i have to add CATALINA_HOME to the
environment variables of the system?

Thanks a lot.
Post by Mark Thomas
Post by maux
Hi,
I would like to know how can i catch the catalina_home variable in a java
code.
Thanks in advance.
System.getenv()
Mark
---------------------------------------------------------------------
--
View this message in context: http://www.nabble.com/Obtain-catalina-home-variable-tp17509750p17514569.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: ***@tomcat.apache.org
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org
Konstantin Kolinko
2008-05-29 00:11:44 UTC
Permalink
The answer is correct as a direct match to the question, but I would
recommend using the following code instead:

System.getProperty("catalina.home")
System.getProperty("catalina.base")


The catalina.bat / catalina.sh script passes values of CATALINA_*
environment variables as system properties, when launching the JVM,
e.g., citing from one of those files:

-Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%"

When launching Tomcat as service in MS Windows those system properties
are defined directly by the service launcher (see Java Options field
in Java tab in the configuration dialog).
Post by Mark Thomas
Post by maux
Hi,
I would like to know how can i catch the catalina_home variable in a java
code.
Thanks in advance.
System.getenv()
Mark
---------------------------------------------------------------------
To start a new topic, e-mail: ***@tomcat.apache.org
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org
maux
2008-05-29 14:18:47 UTC
Permalink
Hi Konstantin,

That´s exactly what i wanted. But if I used
"System.getProperty("catalina.home")", that is ok for windows and for linux
Tomcat installation or is it only valid for windows?

Thank you very much.
Post by Konstantin Kolinko
The answer is correct as a direct match to the question, but I would
System.getProperty("catalina.home")
System.getProperty("catalina.base")
The catalina.bat / catalina.sh script passes values of CATALINA_*
environment variables as system properties, when launching the JVM,
-Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%"
When launching Tomcat as service in MS Windows those system properties
are defined directly by the service launcher (see Java Options field
in Java tab in the configuration dialog).
Post by Mark Thomas
Post by maux
Hi,
I would like to know how can i catch the catalina_home variable in a java
code.
Thanks in advance.
System.getenv()
Mark
---------------------------------------------------------------------
--
View this message in context: http://www.nabble.com/Obtain-catalina-home-variable-tp17509750p17536228.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: ***@tomcat.apache.org
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org
Konstantin Kolinko
2008-05-29 14:44:44 UTC
Permalink
Yes, it is OK for all operating systems.
Post by maux
Hi Konstantin,
That´s exactly what i wanted. But if I used
"System.getProperty("catalina.home")", that is ok for windows and for linux
Tomcat installation or is it only valid for windows?
Thank you very much.
Post by Konstantin Kolinko
The answer is correct as a direct match to the question, but I would
System.getProperty("catalina.home")
System.getProperty("catalina.base")
The catalina.bat / catalina.sh script passes values of CATALINA_*
environment variables as system properties, when launching the JVM,
-Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%"
When launching Tomcat as service in MS Windows those system properties
are defined directly by the service launcher (see Java Options field
in Java tab in the configuration dialog).
Post by Mark Thomas
Post by maux
Hi,
I would like to know how can i catch the catalina_home variable in a java
code.
Thanks in advance.
System.getenv()
Mark
---------------------------------------------------------------------
---------------------------------------------------------------------
To start a new topic, e-mail: ***@tomcat.apache.org
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org
maux
2008-06-02 13:27:21 UTC
Permalink
Thanks a lot.
Post by Konstantin Kolinko
Yes, it is OK for all operating systems.
Post by maux
Hi Konstantin,
That´s exactly what i wanted. But if I used
"System.getProperty("catalina.home")", that is ok for windows and for linux
Tomcat installation or is it only valid for windows?
Thank you very much.
Post by Konstantin Kolinko
The answer is correct as a direct match to the question, but I would
System.getProperty("catalina.home")
System.getProperty("catalina.base")
The catalina.bat / catalina.sh script passes values of CATALINA_*
environment variables as system properties, when launching the JVM,
-Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%"
When launching Tomcat as service in MS Windows those system properties
are defined directly by the service launcher (see Java Options field
in Java tab in the configuration dialog).
Post by Mark Thomas
Post by maux
Hi,
I would like to know how can i catch the catalina_home variable in a java
code.
Thanks in advance.
System.getenv()
Mark
---------------------------------------------------------------------
---------------------------------------------------------------------
--
View this message in context: http://www.nabble.com/Obtain-catalina-home-variable-tp17509750p17601314.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: ***@tomcat.apache.org
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org
Narendra Sharma
2008-06-02 13:28:51 UTC
Permalink
The OS doesn't really matter as you are using a Java property.

It should work the same way on windows and Linux.

Regards,
Narendra Sharma,
Technical Architect.

-----Original Message-----
From: maux [mailto:***@wanadoo.es]
Sent: Monday, June 02, 2008 6:57 PM
To: ***@tomcat.apache.org
Subject: Re: Obtain catalina-home variable


Thanks a lot.
Post by Konstantin Kolinko
Yes, it is OK for all operating systems.
Post by maux
Hi Konstantin,
That´s exactly what i wanted. But if I used
"System.getProperty("catalina.home")", that is ok for windows and for linux
Tomcat installation or is it only valid for windows?
Thank you very much.
Post by Konstantin Kolinko
The answer is correct as a direct match to the question, but I would
System.getProperty("catalina.home")
System.getProperty("catalina.base")
The catalina.bat / catalina.sh script passes values of CATALINA_*
environment variables as system properties, when launching the JVM,
-Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%"
When launching Tomcat as service in MS Windows those system properties
are defined directly by the service launcher (see Java Options field
in Java tab in the configuration dialog).
Post by Mark Thomas
Post by maux
Hi,
I would like to know how can i catch the catalina_home variable in a java
code.
Thanks in advance.
System.getenv()
Mark
---------------------------------------------------------------------
---------------------------------------------------------------------
--
View this message in context: http://www.nabble.com/Obtain-catalina-home-variable-tp17509750p17601314.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: ***@tomcat.apache.org
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org


---------------------------------------------------------------------
To start a new topic, e-mail: ***@tomcat.apache.org
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org
Loading...