Enviornment variables for Glassfish, Tomcat and Jetty.

To store the values of the frequently used parameters environment variables are required. Setting and using  placeholders instead of specifying the required values in the app’s code each time they are needed, makes my application more portable and flexible. It brings even more convenience if these values may differ from one host to another.

There is a number of environment variables for the commonly used directories that are set by default at CloudJiffy application servers - see the lists below.

CloudJiffy also gives you the possibility to declare your own custom environment variables (user-defined parameters to be used with applications) by means of adding the needed values to a special config file and in such a way, keeping them out of the code. Inside this file, you can set placeholders for my folder’s names, user names, passwords, host names, IP addresses etc instead of hardcoding their values to every file they are required in.

The most common way of adding my own custom variables to any of the servers in my CloudJiffy environment is described in the Setting Custom Env Variables via SSH guide. Also, there is a separate instruction on setting custom variables and JVM options through the CloudJiffy dashboard for Java app servers.

And the next section provides names and values for the predefined environment variables, grouped according to particular app servers. Feel free to use them while adjusting my apps.


The following default environment variables are set for Tomcat 6, Tomcat 7 and TomEE application servers:

Variable Value (server path)
user.home /opt/tomcat/temp
user.dir /opt/tomcat/temp
java.io.tmpdir /opt/tomcat/temp
java.home /usr/java/latest
catalina.home /opt/tomcat/
catalina.base /opt/tomcat/

The following environment variables are set for Glassfish 3:

Variable Value (server path)
user.home /opt/glassfish3/temp
user.dir /opt/glassfish3/glassfish/domains/domain1/config
java.io.tmpdir /tmp
java.home /usr/java/latest
logs   /opt/glassfish3/glassfish/domains/domain1/logs/

The following environment variables are set for Jetty 6:

Variable Value (server path)
user.home /opt/jetty/home
user.dir /opt/jetty/home
java.io.tmpdir /opt/jetty/tmp
java.home /usr/java/latest

Note: despite of the names, temp and tmp directories are NOT automatically cleaned by CloudJiffysystem. 



Was this article helpful?

mood_bad Dislike 0
mood Like 0
visibility Views: 10944