Submitted by Ahmed Hashim on Sat, 17/09/2005 - 07:06.
( categories: )

How to setup Apache Tomcat on Linux?

  • Download Java SDK from

http://java.sun.com/j2se/1.4.2/download.html download the "self-extracting file"

  • Install Java SDK

Open new shell type su to login as root


#su
#chmod +x j2sdk-1_4_2_09-linux-i586.bin
#./j2sdk-1_4_2_09-linux-i586.bin

press enter till finish the agreement and type y to start installation. you will find it installed in your home directory

  • set Java Environment Variables

#export JAVA_HOME=/home/hashim/j2sdk1.4.2_09/
#export PATH=${JAVA_HOME}/bin

replace the directory above with the correct directory according to your system.

  • Test Java version

if you want to know the current java version type

#java -version
you should see


Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_09-b05)
Java HotSpot(TM) Client VM (build 1.4.2_09-b05, mixed mode)
  • Download Tomcat

http://jakarta.apache.org/site/downloads/downloads_tomcat-5.cgi download version 5.0.28 to be compatible with JDK 1.4.2 because the latest versions of tomcat require JDK5

http://ftp.wayne.edu/apache/jakarta/tomcat-5/v5.0.28/bin/jakarta-tomcat-5.0.28.tar.gz

  • extract tomcat

#tar xvfz jakarta-tomcat-5.0.28.tar.gz

  • Install Tomcat

#cd jakarta-tomcat-5.0.28
#cd bin
#tar xvfz jsvc.tar.gz
#cd jsvc-src
#chmod +x configure
#./configure
#make
#cp jsvc ..
#cd ..
  • Run Tomcat

#./startup.sh

open web browser and type http://localhost:8080/ you should see the Tomcat Administration page

  • Test Tomcat

go to webapps/ROOT in the tomcat directory and create page hello.html and write in it

 Hello Tomcat

open the URL http://localhost:8080/hello.html you should see your page

  • Make JSP page

go to webapps/ROOT in the tomcat directory and create page hello.jsp and write in it the following lines


 < %=new String("Hello Ahmed Hashim")% >
<br>
< %=new java.util.Date()% >
<br>

save and run the following URL http://localhost:8080/hello.jsp you should see my Name

  • Monitor Tomcat

you can see the log file in the logs directory

  • Stop Tomcat

go to the tomcat bin directory

#./shutdown.sh

Note:- I can see that Tomcat on Linux faster that tomcat in windows at least 3 times in both startup, shutdown and in compiling.


why script sample didnt appea

Ahmed Hashim's picture

why script sample didnt appear?


----
Ahmed Hashim
Hacker from the Earth

the '%' character should appe

the '%' character should appear directly after/before the start/closing tag marker ..so it would be like &lt;=%new java.util.Date()%&gt;

and not &lt; =%new java.util.Date()% &gt;

if you're _sure_ that your JSP/EL syntax is correct but still things are going wrong (and Tomcat threw no exceptions), you can decompile the generated class to know what's actually going on. Jasper, the Tomcat JDT-based JSP compiler, compiles JSP pages into an HttpServlet subclass and deploy it. Your Tomcat distribution should putz such classes in a directory named "work" somewhere in it's hierarchy. I use Jad (http://www.kpdus.com/jad.html#download) for bytecode decompilation.

I don't know what you are tal

Ahmed Hashim's picture

I don't know what you are talking about, about my last comment on this page it was about the format of the script in side the artile not as a JSP code.

Anyway, It is the first time to see a way for bug fixing in JSP with Decompiling the compiled generates code!! thnx :)


----
Ahmed Hashim
Hacker from the Earth

lol ok.. next time explicitly

lol ok.. next time explicitly delcare what's going wrong... and you're welcome

ok

Ahmed Hashim's picture

OK, sorry for this. by the way whats ur name?

:)


----
Ahmed Hashim
Hacker from the Earth

same as your first

same as your first

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.