Entry
Tomcat: How to install Tomcat v6 on Microsoft Windows XP? [JSP / servlet / Java]
Apr 21st, 2007 11:54
Knud van Eeden,
----------------------------------------------------------------------
--- Knud van Eeden --- 21 April 2021 - 08:51 pm ----------------------
Tomcat: How to install Tomcat v6 on Microsoft Windows XP? [JSP /
servlet / Java]
Steps: Overview:
1. -Download and install Tomcat
1. -Create a directory
E.g.
c:\TOMCAT\
2. -Goto URL
http://tomcat.apache.org/download-60.cgi
3. -Download
apache-tomcat-6.0.10.zip
4. -Unzip this zip file in that directory
E.g. unzip using a command line unzip program
pkzipc.exe -extract -dir apache-tomcat-6.0.10.zip c:\TOMCAT\
2. -Download and install Sun Java JDK
1. -Goto URL
http://java.sun.com/javase/downloads/index.jsp
2. -Download
E.g.
'JDK 6u1 with NetBeans 5.5'
jdk-6u1-nb-5_5-win-ml.exe
1. -Note: The minimum you will have to install is
at least the Java Run Time Environment
(=Java JRE)
but this is already automatically
included in the Java JDK or Java EE.
If you also want to develop Java programs yourself
(e.g. servlets and Java Server Pages (=JSP)),
then download and install the JDK 1.6 (=JDK 6 or
J6SE) or if enterprise development choose J6EE)
If you choose to have a minimum installation,
only download and install the Java JRE 6.
That will allow you only to run Tomcat
and or already developed Java programs.
3. -After installation you should see 2 directories:
(by default in c:\program files\Java)
jdk1.6.0_01 (that is the directory for your Java development)
and
jre1.6.0_01 (that is the directory of your Java run time
(JRE))
3. -Set Microsoft Windows environment variables
1. -Set this variables globally in Microsoft Windows control panel
('System'->'Advanced'->'Environment variables'->'User
variable'->'New')
-- or --
in a .bat batch file which starts at Microsoft Windows startup
-- or --
in file 'setenv.bat' in Tomcat directory
1. -Set
CATALINA_HOME=<your Tomcat root directory (=one
directory above its 'bin' directory)>
E.g.
SET CATALINE_HOME=c:\TOMCAT\apache-tomcat-6.0.10
2. -Set
JAVA_HOME=<your JDK installation root directory (=one
directory above 'bin' directory)>
E.g.
SET JAVA_HOME=C:\Program Files\Java\jdk1.6.0_01
===
Note:
1. -You do not have to include the last backward
slash '\' in the path
Thus use:
SET CATALINE_HOME=c:\TOMCAT\apache-tomcat-6.0.10
and do not use
SET CATALINE_HOME=c:\TOMCAT\apache-tomcat-6.0.10\
2. -You should not use forward slashes '/' in the path
Thus use:
SET CATALINE_HOME=c:\TOMCAT\apache-tomcat-6.0.10
and do not use
SET CATALINE_HOME=c:/TOMCAT/apache-tomcat-6.0.10
and do not use
SET CATALINE_HOME=c:/TOMCAT/apache-tomcat-6.0.10/
3. -You do not have to include the '\bin' directory in
the path
Thus use:
SET CATALINE_HOME=c:\TOMCAT\apache-tomcat-6.0.10
and do not use
SET CATALINE_HOME=c:\TOMCAT\apache-tomcat-6.0.10\bin
and do not use
SET CATALINE_HOME=c:\TOMCAT\apache-tomcat-6.0.10\bin\
4. -It is not necessary to use the short filename
in the filepath for JAVA_HOME
as double quotes are used internally
Thus use:
SET JAVA_HOME=C:\Program Files\Java\jdk1.6.0_01
and you do thus not have to use instead
SET JAVA_HOME=C:\Progra~1\Java\jdk1.6.0_01
5. -It is not necessary to use double quotes around
the filepath
as double quotes are already used internally
Thus use:
SET JAVA_HOME=C:\Program Files\Java\jdk1.6.0_01
and do not use
SET JAVA_HOME="C:\Program Files\Java\jdk1.6.0_01"
6. -Double check if the variables are set correctly by
e.g. opening a *new* MSDOS box, and typing
SET CATALINA_HOME
and
SET JAVA_HOME
This should show the correct filepaths as described
above
7. -Check if the directories are OK
dir %CATALINA_HOME
should show the Tomcat root directory
and
dir %JAVA_HOME
should show the Java JDK root directory
4. -Run Tomcat
You have at least 2 possibilities to run Tomcat,
or by running Tomcat as a service, or by
running Tomcat via
startup.bat
1. -Run Tomcat via the batch file 'startup.bat'
===
E.g. to run it in the current MSDOS box, type
c:\TOMCAT\apache-tomcat-6.0.10\bin\startup.bat
That will show e.g. output similar to
--- cut here: begin --------------------------------------------------
Apr 21, 2021 7:58:09 PM org.apache.catalina.core.AprLifecycleListener
init
INFO: The Apache Tomcat Native library which allows optimal
performance in production environments was not found on the
java.library.path: C:\Progra~1\Java\
jdk1.6.0_01
\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOW
S\system32;C:\WINDOWS;
Apr 21, 2021 7:58:09 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Apr 21, 2021 7:58:09 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1252 ms
Apr 21, 2021 7:58:09 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Apr 21, 2021 7:58:09 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
Apr 21, 2021 7:58:10 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Apr 21, 2021 7:58:10 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Apr 21, 2021 7:58:11 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/100 config=null
Apr 21, 2021 7:58:11 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1863 ms
--- cut here: end ----------------------------------------------------
===
E.g. to start it in another MSDOS box, type
start c:\TOMCAT\apache-tomcat-6.0.10\bin\startup.bat
===
Running startup.bat is equivalent to running
catalina.bat start
Using this parameter 'start' will redirect
any output in the log files located in
<root directory of Tomcat>\logs\
To stop the Tomcat server, run the batch file in the 'bin'
directory
shutdown.bat
===
Note:
You could e.g. choose to put a shortcut to this startup.bat
file on your desktop
Similarly create a shortcut to shutdown.bat to shut down
cleanly the Tomcat server
===
Note: Trouble shooting:
If you start
startup.bat
or similarly
catalina.bat start
from a JPSoft 4DOS/4NT (e.g. v8.00.36) box
you will get the error
"The system cannot find the file specified"
The solution here is to not start it in a 4DOS/4NT DOS box,
but to run it via an Microsoft MSDOS box (e.g. run 'cmd.exe')
instead. That works OK, without errors.
If you choose to keep using 4DOS/4NT here, use instead the
command. That should work OK, without errors.
catalina.bat run
2. -Run Tomcat via the batch file
catalina.bat run
Using this parameter 'start' will redirect
any output in the same console.
This might be handy if you want to debug.
===
3. -You will have to keep the MSDOS box with Tomcat running open,
otherwise you close Tomcat down, and your Tomcat web page
will not show
5. -Test if Tomcat works OK
1. -Open a browser
2. -Type the URL
http://localhost:8080
3. -You should see a page showing e.g.
--- cut here: begin --------------------------------------------------
Apache Tomcat
If you're seeing this page via a web browser, it means you've setup
Tomcat successfully. Congratulations!
As you may have guessed by now, this is the dn befault Tomcat home
page.
It can be found on the local filesystem at:
%CATALINA_HOME/webapps/ROOT/index.html
where "$CATALINA_HOME" is the root of the Tomcat installation
directory.
If you're seeing this page, and you don't think you should be, then
either you're either a user who has arrived at new installation of
Tomcat, or you're an administrator who hasn't got his/her setup quite
right. Providing the latter is the case, please refer to the Tomcat
Documentation for more detailed setup and administration information
than is found in the INSTALL file.
NOTE: For security reasons, using the administration webapp is
restricted to users with role "admin". The manager webapp is
restricted to users with role "manager". Users are defined in
$CATALINA_HOME/conf/tomcat-users.xml.
Included with this release are a host of sample Servlets and JSPs
(with associated source code), extensive documentation, and an
introductory guide to developing web applications.
Tomcat mailing lists are available at the Tomcat project web site:
users@tomcat.apache.org for general questions related to configuring
and using Tomcat dev@tomcat.apache.org for developers working on
Tomcat
Thanks for using Tomcat!
--- cut here: end ----------------------------------------------------
4. -If you get a 'Page can not be displayed' error make e.g. sure
Tomcat runs (that is the black MSDOS box is open and the
Tomcat is
running inside, without errors).
Otherwise check e.g. the Tomcat logs in
c:\TOMCAT\apache-tomcat-6.0.10\logs\
===
Tested successfully on
Microsoft Windows XP Professional (service pack 2),
running
Tomcat v6.0.10
Java JDK v6
===
Internet: see also:
---
Tomcat: Link: Can you give an overview of links?
http://www.faqts.com/knowledge_base/view.phtml/aid/45112/fid/1669
----------------------------------------------------------------------