Up until last year, we raised each student's disk quota, since tomcat is fairly large (somewhere in excess of 20 megabytes). After discussing this with one of the sysadmins downstairs, we decided not to do that this year, since everyone's quota is already at 125 megabytes, which should be more than adequate. If you hit a wall in terms of disk usage, let me know, and we'll see what we can do.
tar xfz ~karl/public/270/apache-tomcat-5.5.15.tar.gzThis should create the directory
ln -s `pwd`/apache-tomcat-5.5.15 ~/tomcat
jspapplications will be stored:
mkdir ~/webapps mkdir ~/webapps/WEB-INF mkdir ~/webapps/WEB-INF/classes mkdir ~/webapps/WEB-INF/lib
~/tomcat/webapps/to your webapps directory. This symlink will be of the form
webapps-username; for example, mine is
ln -s ~/webapps ~/tomcat/webapps/webapps-`whoami`
setenv JAVA_HOME /usr/java/currentIn the
export JAVA_HOME=/usr/java/currentYou'll probably want to also set up
JAVA_HOMEor other environment variables automatically when you log in by adding the above line(s) in your
.bashrcfile respectively, depending on whether you use
~/tomcat/bin/startup.shNOTE: You should shutdown tomcat when you are done using
~/tomcat/bin/shutdown.shThis 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.shThen, you will only need to type sta, shu, or restart to have the desired effect.
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).
makeThis will use the GNUMakefile in that directory to install the file hello.jsp in the directory ~/webapps.
~/tomcat/logs/catalina.outwill record output sent to
tomcatdoesn't go hunting for them on every query.
~/webapps/is for your
jspfiles. You may choose to save them in a subdirectory to keep webapps/ clean, such as
jsp. Depending on whether you choose to make a
jspdirectory, the URL to
~/webapps/WEB-INF/classes/is where you'll save compiled
.classfiles. Note that class files must be part of packages, so will be in subdirectories of
classes. For example, the class
edu.gustavus.karl.MyClasswill be in
~/tomcat/bin/shutdown.sh ; ~/tomcat/bin/startup.shIt'll take about 30 seconds to a minute to restart. If you did the aliases I described above, you will only need to type shu.
~/tomcat/bin/shutdown.shor you can choose the brutal but expedient,
killall javaThis will kill all java processes you have launched, including tomcat.
numwhich contains an application I will explain on Thursday. If you go to that directory and type
ls, you should see 3 files; please read through them. Observe that the
GNUmakefilecontains information (which you can edit) about where the webapp files will be deployed.
GNUmakefileto your liking and then type
numguess.jspin your browser just as you did for
hello.jsp. (You may need to restart tomcat if tomcat doesn't find it.)
NumberGuessBean.javato 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.outfile to trace the guesses.
~/tomcat/webapps/examples/. You should make copies of the into source directories, like my
numdirectory, copy the
mysql, you'll need to install the appropriate jar file. You may wish to take care of that now:
cp -r ~karl/public/270/mysql.jar ~/tomcat/common/lib