- Extract your version of tomcat: Switch to your home
directory, since that is where you should install tomcat. (You could
put it elsewhere, but it will be better if you put it there, since it
will then be easier for me to describe how to do this, and also to
check for installation errors.) From your home directory, issue the
following command:
tar xfz ~karl/public/270/apache-tomcat-5.5.15.tar.gz
This should create the directory apache-tomcat-5.5.15/
- To save time typing, put a symlink from tomcat
in your home directory to the installation directory,
apache-tomcat-5.5.15. (This should be done before changing directory.)
ln -s `pwd`/apache-tomcat-5.5.15 ~/tomcat
- Create the directory where
jsp
applications will be stored:
mkdir ~/webapps
mkdir ~/webapps/WEB-INF
mkdir ~/webapps/WEB-INF/classes
mkdir ~/webapps/WEB-INF/lib
- Create a symlink in
~/tomcat/webapps/ to your
webapps directory. This symlink will be of the form
webapps-username; for example, mine is
webapps-karl:
ln -s ~/webapps ~/tomcat/webapps/webapps-`whoami`
- Set environment variable for
JAVA_HOME to
/usr/java/default In a csh shell,
use
setenv JAVA_HOME /usr/java/default
In the bash shell, use
export JAVA_HOME=/usr/java/default
You'll probably want to also set up JAVA_HOME or other
environment variables automatically when you log in by adding the
above line(s) in your .cshrc file and/or .bashrc
file respectively, depending on whether you use csh and/or bash.
- Start up tomcat:
~/tomcat/bin/startup.sh
NOTE: You should shutdown tomcat when you are done using
~/tomcat/bin/shutdown.sh
This frees up the 8080 port for a classmate. Also, you can make
starting up, shutting down, and restarting tomcat easier by putting
the following aliases in .cshrc:
alias sta ~/tomcat/bin/startup.sh
alias shu ~/tomcat/bin/shutdown.sh
alias restart ~/tomcat/bin/shutdown.sh \; ~/tomcat/bin/startup.sh
Then, you will only need to type sta, shu, or restart to have the
desired effect.
- Copy my jsp work directory: Go to the directory
where you want to do your jsp programming and issue the following
command:
cp -r ~karl/public/270/jsp .
This will create a directory called jsp which currently contains two
sub-directories, one called called hello, which contains the Hello
World application I described in class yesterday, and another called
num (which is described later).
- Install the Hello World application: Move to
the jsp/hello directory and type the following command:
make
This will use the GNUMakefile in that directory to install the file
hello.jsp in the directory ~/webapps.
- Launch the Hello World application: You can
view sample jsp page by entering something like this in the URL:
http://localhost:8080/webapps-username/hello.jsp
- Check-off: Show me that you have successfully
viewed this file.