next up previous contents
Next: The Velocity helloworld servlet Up: Using Velocity Previous: Storing velocity.jar in directory

Altering build.sh

At this point the velocity.jar file is in the right place.

We'll be writing a servlet that needs the jar file to compile. The classpath has to be altered in the build.sh file.

Add the line:

   CP=$CP:./lib/velocity-1.1-rc1.jar
You will have a build.sh file that looks like this:
   #!/bin/sh
   # build.sh -- Build Script for the "Hello, World" Application
   # $Id: build.sh,v 1.1.2.2 2000/11/27 22:45:59 craigmcc Exp $
   
   # Identify the custom class path components we need
   CP=$TOMCAT_HOME/lib/ant.jar:$TOMCAT_HOME/lib/servlet.jar
   CP=$CP:$TOMCAT_HOME/lib/jaxp.jar:$TOMCAT_HOME/lib/parser.jar
   CP=$CP:$JAVA_HOME/lib/tools.jar
   CP=$CP:./lib/velocity-1.1-rc1.jar
   
   # Execute ANT to perform the requested build target
   java -classpath $CP:$CLASSPATH org.apache.tools.ant.Main \
     -Dtomcat.home=$TOMCAT_HOME "$@"
The build.sh file is now ready to compile a velocity servlet.



Copyright © 2001, R.M. Morriën, H.P.A.M. Snoek, M.A.C. Bakker