tar xfz ~wolfe/public/270/tomcat.tgz
This should create the directory jakarta-tomcat-4.1.29/
ln -s `pwd`/jakarta-tomcat-4.1.29 ~/tomcat
~/tomcat/webapps/
to your webapps directory. On mcs-jsp, I named the symlinks
webapps-username, so mine is webapps-wolfe.
cd ~/tomcat/webapps
ln -s ~/webapps ~/tomcat/webapps/webapps-username
jsp applications will
be stored:
mkdir ~/webapps mkdir ~/webapps/WEB-INF mkdir ~/webapps/WEB-INF/classes mkdir ~/webapps/WEB-INF/lib
JAVA_HOME to
/usr/java/current
In a csh shell, use
setenv JAVA_HOME /usr/java/current
In the bash shell, use
export JAVA_HOME=/usr/java/current
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.
~/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.
http://localhost:8080/webapps-username/hello.jsp
You'll want to launch tomcat yourself rather than using the tomcat
process running on mcs-jsp.gac.edu for several reasons:
~/tomcat/logs/
In particular,
~/tomcat/logs/catalina.out
will record output sent to System.out
~/tomcat/work/Standalone/localhost/webapps-username/
tomcat doesn't go
hunting for them on every query.
webapps/ is for your
jsp files. You may choose to save them in a subdirectory
to keep webapps/ clean, such as jsp. Depending on
whether you choose to make a jsp directory, the URL to
mywebpage.jsp would be
http://localhost:8080/webapps-username/mywebpage.jsp
or
http://localhost:8080/webapps-username/jsp/mywebpage.jsp
webapps/WEB-INF/classes/ is where
you'll save compiled
.class files. Note that class files must be
part of packages, so will be in subdirectories of
classes. For example, the class
edu.gustavus.wolfe.MyClass will be in
webapps/WEB-INF/classes/edu/gustavus/wolfe/MyClass.class
webapps/WEB-INF/lib/ is for jar files.
~/tomcat/bin/shutdown.sh ; ~/tomcat/bin/startup.sh
It'll take about 30 seconds to a minute to restart.
~/tomcat/bin/shutdown.sh
or you can choose the brutal but expedient,
killall java
This will kill all java processes you have launched, including tomcat.
NumberGuessBean.java and
numguess.jsp (distributed with tomcat) in a single
directory along with a Makefile which knows how to compile them. To
install, copy the directory to anywhere in your home directory:
cd directory-name-of-your-choosing
cp -r ~wolfe/public/270/jspapps/num/ .
cd ./num
ls -l
You should see 3 files; please read through them. Observe that the
GNUmakefile contains information (which you can edit)
about where the webapp files will be deployed.
GNUmakefile to your liking and then type
make
numguess.jsp in your browser just as you did
for hello.jsp. (You may need to restart tomcat if tomcat
doesn't find it.)
numguess.jsp and
NumberGuessBean.java to try some experiments. For
example, you could, for instance, make the game easy hard-coding your
favorite number as the answer. You could also put change the Bean so
that it outputs the guess by placing a line like
System.out.println("User guessed: " + guess)
in an appropriate place in NumberGuessBean.java. After
running the app, you can inspect the catalina.out file to
trace the guesses.
~/tomcat/webapps/examples/. You should make copies of
the
into source directories, like my num directory, copy the
GNUmakefile and play.
jdbc with mysql, you'll need to
install the appropriate class files. You may wish to take care of
that now:
cp -r ~wolfe/public/270/java/com/ ~/tomcat/shared/classes/These are class files which are shared among apps.