Java system variables in Linux environment
Posted by on 28 January 2013 03:01 PM

The background:

FC Webmail and Workflow uses Apache Tomcat Server that does require Java to be installed on server. Tomcat always looks for environment variable JRE_HOME that points to the location of java in the system before the FC software is launched.


The problem:

In Linux system the variable JRE_HOME very often is not automatically set or updated after the java is installed especially when java was installed through simple extracting files from the installer package. To check if you do have java environment variables properly set in your server open Terminal or XTerm (command line) and run two commands:

java -version
echo $JRE_HOME

If the first command returns error "Command not found" or similar then you to not have properly set PATH variable.
If the second command returns blank (empty) line then you do not have properly set JRE_HOME variable.


The solution:

The quick (temporary) solution is enabling those two variables on-the-fly by entering following commands in terminal window (assuming your java is installed in folder "/opt/jre"):

export JRE_HOME
export $PATH

Now you should see proper respond to commands:

java -version
echo $JRE_HOME

This solution will keep environment variables in memory until your server is restarted. To have more permanent solution that will force server to remember those variables after computer is restarted you can modify file "/etc/environment" (you need administrative privileges to to this). In this file there may be already defined variable PATH, for example:

You need to modify this entry to include your java, for example:
Then add a line with new variable:

Some Linux distributions recommend to add modified variables to file "/etc/profile". In this case following lines should be added to the end of the "profile" file:

export PATH
export JRE_HOME

Changes in "profile" will take effect after server is restarted.

(2 vote(s))
Not helpful

Comments (0)