Environment Variables

Environment variables are used to store the values of the frequently used parameters, that are provided to a software program at runtime. Setting and using such placeholders instead of specifying the required values in the app’s code each time they are needed, makes your 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 Jelastic application servers - see the lists below.

Jelastic 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 your 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 your own custom variables to any of the servers in your Jelastic 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 Jelastic 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 your apps.

Default Environment Variables

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

VariableValue (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:

VariableValue (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:

VariableValue (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 Jelastic system.