Setting System Variables on a Linux Machine
The following steps will walk you through adding System Environment Variables to a machine running Linux.
1. Open the terminal (shell) on your server.
2. Enter the following command(s) to define and export your JAVA_HOME variable.
Set Variables Command
JAVA_HOME=/opt/java/jdk1.6.0
export JAVA_HOME
Warning
- The variable value shown above is an example. When adding the JAVA_HOME variable in your environment you need to enter the path for your Java JDK directory.
- It is extremely important the path is to the JDK location and not to the Java root directory.
- The same holds true when you add the JBOSS_HOME and ANT_HOME variables in the next steps. The JBOSS_HOME variable needs to have the path for your JBoss directory and the ANT_HOME variable should have the path for your Ant directory.
3. Enter the following command(s) to define and export your JBOSS_HOME variable.
Set Variables Command
JBOSS_HOME=/opt/jboss-as-7.1.1.Final
export JBOSS_HOME
4. Enter the following command(s) to define and export your ANT_HOME
Set Variables Command
ANT_HOME=/opt/apache-ant-1.8.2
export ANT_HOME
5. Enter the following to update your PATH variable
Set Variables Command
PATH=$PATH:$ANT_HOME/bin:$JAVA_HOME/bin
Note
You do not need to export PATH because it has already been exported. If for some reason your PATH has never been exported then you will need to do it now. Simply adding variables to the PATH does not require you to export it again.