Thursday, July 22, 2010

Setup Java environment variables

To run Java applications we need JRE, Java runtime environment. If we want to build new Java applications it is neccessary to install JDK, Java development kit.

After installation we should set following environment variables to let application servers and development environment start properly. Paths depend on Java version and installation directories:

PATH=%PATH%;C:\Program Files\Java\jdk1.6.0_21\bin;
JAVA_HOME=C:\Program Files\Java\jdk1.6.0_21
C:\Program Files\Java\jdk1.6.0_21\jre\lib;
C:\Soft\Apache Tomcat\apache-tomcat-6.0.28\lib\jsp-api.jar;
C:\Soft\Apache Tomcat\apache-tomcat-6.0.28\lib\servlet-api.jar;.

Easiest way is to set the variables system-wide. In WinXP it is done by: Control Panel / System / Details / System variables. In Linux it is done by adding variables to user init script, e.g. .bashrc.

Note that CLASSPATH is one-line string variable. I just divided it to multiple lines for better readability.

No comments: