Pr.Pg Next Pg

Setting up CLASSPATH tutorials

  • Since servlets are not part of the Java 2 Platform, Standard Edition, you have to identify the servlet classes to the compiler. The server already knows about the servlet classes, but the javac compiler probably doesn’t know.

  • If you are running Windows, you need to put the following lines in your C:\autoexec.bat file.

set CATALINA=C:\Program Files\Apache Software Foundation\apache-tomcat-6.0.20

set CLASSPATH=%CATALINA%\common\lib\servlet-api.jar;%CLASSPATH%

  • Alternatively, on Windows NT/2000/XP, you could also right-click on My Computer, select Properties, then Advanced, then Environment Variables. Then, you would update the CLASSPATH value and press the OK button.

  • On Unix, Solaris, Linux, etc. if you are using the C shell, you would put the following lines into your .cshrc file.

setenv CATALINA=/usr/local/apache-tomcat-6.0.20

setenv CLASSPATH $CATALINA/common/lib/servlet-api.jar:$CLASSPATH

Pr.Pg border                                              Next Pg