Step by Step Instructions on How to Add CLASSPATH in Unix Environment

Oguzhan Topsakal

April 2006

 

To run a jasper report from your Servlet application, you need to put the following libraries in a directory in your CISE Unix account and specify the CLASSPATH for them.

The file that you can specify the class path is .cshrc file > in your CISE home directory. But be careful while modifying this file.
  1. Your Servlet code gives errors for the Jasper Report specific classes you used in your code in the Servlet Example.
  2. Open a session (shell A) with putty and connect to a CISE Unix machine.
  3. Open another session (shell B) with putty and connect to a CISE machine.
  4. With shell A, open an editor, modify .cshrc file and add the following line at the end (change this line according to your home directory and according to the directory you put jasper report libraries. javaLib is the directory that I put the jar files under my home directory /cise/homes/otopsaka/):
setenv CLASSPATH .:/cise/homes/otopsaka/javaLib/commons-fileupload-1.1.jar:/cise/homes/otopsaka/javaLib/jasperreports-1.2.0.jar:/cise/homes/otopsaka/javaLib/commons-digester-1.7.jar:/cise/homes/otopsaka/javaLib/commons-collections-2.1.jar:/cise/homes/otopsaka/javaLib/commons-logging-1.0.2.jar:/cise/homes/otopsaka/javaLib/commons-beanutils-1.5.jar:/cise/homes/otopsaka/javaLib/servlet-api.jar:/cise/homes/otopsaka/javaLib/commons-io-1.2.jar:$CLASSPATH 
  1. Save .cshrc file.
  2. Run the command:  source .cshrc in shell A.
  3. If you got an error when you sourced the file open the .cshrc file using shell B, then remove the line of code you added.
  4. If there is no error then test the changes in shell A, run "env" command to see the changes in your classpath.
  5. Test your code again.
    
 

Prepared by Oguzhan Topsakal

April, 2006