![]()
Install Apache Xerces
Download the binary package Xerces-J-bin.2.5.0.tar.gz from
OR download the Xerces binary package from the download directory on the class website (if you do this you will be able to skip one step, as the tar file has already been gun-zipped):Use the following command to unpack the .gz package:
gunzip Xerces-J-bin.2.5.0.tar.gz
gtar xvf Xerces-J-bin.2.5.0.tar
You should delete Xerces-J-bin.2.5.0.tar which is no longer needed. Also you should delete the subdirectory "docs" to conserve space, unless you've downloaded the version with no docs.
Setting up the Java VM and SDK
For both Java applications and Java Servlet development, you need to set up a number of environment variables. In your root directory (/home/scf-xx/YOUR-USERNAME/), set the following new environment variables, by appending the following lines to the file .cshrc:
setenv JDK_HOME /usr/j2se
setenv JAVA_HOME /usr/j2se
setenv PATH /usr/j2se/bin/:${PATH}
Then you need to set up the Java CLASSPATH, i.e. where Java looks for JAR files (assuming that you unpacked Xerces in your root directory):setenv XERCES_HOME ~/xerces-2.5.0
setenv CLASSPATH .:${XERCES_HOME}/xercesImpl.jar:${XERCES_HOME}/xmlParserAPIs.jar:${CLASSPATH}
Important: Note the "dot" (the current directory) listed at the beginning of the CLASSPATH. The "javac" compiler always looks for files in the current directory (whether "." is included in the classpath or not), but the "java" interpreter only looks into the current directory if the "." directory is in the classpath. If you have no classpath set this is not a problem -- the default classpath consists of the "." directory -- but if you have set the classpath and forgot to include the ".", then your programs will compile without error, but they won't run. [see Core Java - Volume I Fundamentals, p. 137]You can find more information on how to set the CLASSPATH at http://java.sun.com/j2se/1.4.2/docs/tooldocs/solaris/classpath.html .
You can now invoke the Java compiler to compile your application, as follows:
javac -classpath $CLASSPATH my_java_program.java
You can find more information on "javac", the Java programming language compiler, at http://java.sun.com/j2se/1.4.2/docs/tooldocs/solaris/javac.html .
Then you can use the Java runtime to run your application, as follows:
java -classpath $CLASSPATH my_java_program
You can find more information on "java", the Java application launcher, at http://java.sun.com/j2se/1.4.2/docs/tooldocs/solaris/java.html .
Using Apache Xerces with Servlets
For Servlet development using Tomcat, you should also copy two of the JAR files to the Tomcat directory $TOMCAT/common/endorsed, as follows:
cp $XERCES_HOME/xercesImpl.jar $CATALINA_HOME/common/endorsed
cp $XERCES_HOME/xmlParserAPIs.jar $CATALINA_HOME/common/endorsed
![]()