This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
I have written it for tomcat 5.0.28 in linux. Please get this, its much better. I think the same will apply for 4 also.
Unzip tomcat bundle in a folder. you will get jakarta-tomcat-xxxx folder which is the main tomcat folder, often refered to as $CATALINA_HOME folder.
Go to CATALINA_HOME/bin, take the file setclasspath.sh and add the following two lines in the beginning
JAVA_HOME=/usr/local/j2sdk1.4.2_03/ --comment-- This is the java installation folder (j2sdk...) BASEDIR=/home/aruljose/appl/tomcat/jakarta-tomcat-5.0.28/ --comment-- This is the $CATALINA folder
Go to the user home directory, take the file .bash_profile(a hidden file) and the add the java folder (j2sdk...) to the path. The next line has a sample.
PATH=$PATH:$HOME/bin:/usr/local/Acrobat5/bin:/usr/local/j2sdk1.4.2_03/bin (I have added to the already existing PATH variable by including $PATH)
Then go to bin of $CATALINA and execute startup.sh you will see the following four lines. Using CATALINA_BASE: /home/aruljose/appl/tomcat/jakarta-tomcat-5.0.28 Using CATALINA_HOME: /home/aruljose/appl/tomcat/jakarta-tomcat-5.0.28 Using CATALINA_TMPDIR: /home/aruljose/appl/tomcat/jakarta-tomcat-5.0.28/temp Using JAVA_HOME: /usr/local/j2sdk1.4.2_03/
Once you get these four lines, the web-server is started.
You will see the tomcat page with various documentation details.
Now, how to run a jsp application with Tomcat. In $CATALINA_HOME/webapps you will see some folders, they are the applications deployed in tomcat. So to deploy an application create a folder, say 'applicationFolder' inside webapps. then create a WEB-INF directory inside the newfolder which is a must. inside $CATALINA/webapps/applicationFolder, save your jsp file say hello.jsp.
Execute the files shutdown.sh and startup.sh (found in $CATALINA_HOME/bin) subsequently to restart the web-server.