Overview
This tutorial shows how to install Java and Tomcat. Versions of both Java and Tomcat may change with time but the precedure remains basically identical.
Contents
- Downloading Installation Files
- Installing Java and Tomcat
- Configuring Tomcat
1. Downloading Installation Files
1.1. Downloading Java SE
- Go to URL http://java.sun.com/javase/downloads/index.jsp
- Click on Download link next to JDK 6 subheader
- In the newly opened page check Accept and click on Windows offline installation multi-language
Downloading of file jdk-6-windows-i586.exe will start.
1.2. Downloading Java EE
- Go to URL http://java.sun.com/javaee/downloads/index.jsp
- Click on Download link next to JDK 6 subheader
- In the newly opened page choose Accept and click on Java EE 5 SDK Update 2 under Windows Platform - Java EE SDK 5 Update 2.
Downloading of file java_ee_sdk-5_02-windows.exe will start.
1.3. Downloading Tomcat
- Go to URL http://tomcat.apache.org/download-60.cgi
- Click on zip link under Core subheader
Downloading of file apache-tomcat-5.5.20.zip will start.
2. Installing Java and Tomcat
All of the following applications will be installed in folders inside folder C:\Java. You may choose other folder. The general requirement is that the folder name should not contain spaces. Replace them with underscores ( _ ) if you like. To avoid confusion we will specify folders of Java binaries to reflect their versions.
2.1. Installing Java SE
Java SE (Standard Edition) consists of Java Runtime Environment (RTE) that allows you to run basic Java applications (inluding Applest in your browser) and Java Development Kit (JDK) that allows you to develop and compile basic Java applications and applets. The downloaded file will help you to install both parts.
- Run file jdk-6-windows-i586.exe
- Accept the Licence Agreement
- Click change to change the installation folder
- Enter C:\Java\jdk (or any other folder without spaces) and click OK.
- Click Next to proceed with installation of JDK
- Click on Change
- Change the value of Folder name to C:\Java\jre and click OK
- Click Next to proceed with installation
- The installation of Java SE is finished. Click Finish to exit.
2.2. Installing Java EE
Java EE (Enterprise Edition) is an extension to Java SE. It allows you to developing web-based applications such as servlets, web services, etc.
- Run file java_ee_sdk-5_02-windows.exe. Wait till installation files are extracted
- Click Next at the welcome screen
- Accept the terms and conditions and click Next
- Specify installation directory to be C:\Java\sdk
- When asked agree to create the installation directory
- Specify administrator login and password. We will not be using built in server, so the actual values of credentials do not matter. In suggested values of server ports change 9's to 8's. This is done mainly to exclude the chance of conflict for the HTTP port 8080 that Tomcat will be using. Click Next.
- Uncheck all installation options' boxes and click Next
- Click Install Now to proceed with installation
Wait for Java EE to be installed.
- When installation finishes click Finish to exit
2.3. Installing Tomcat
- Unpack the contents of the apache-tomcat-6.0.24.zip archive into C:\Java\tomcat folder (or any other fodler with spaces).
Note: you should unpack several folders and files. Do not unpack a single folder (usually apache-tomcat-xxx) into C:\Java\tomcat, but what is inside this one folder. Refer to a figure below for the most probable list of content that should be inside C:\Java\tomcat folder.
3. Configuring Tomcat
- Right-click on My Computer and in a pop-up menu click on Properties
- Go to Advanced tab and click on Environment Variables
- In the top portion of the form under User variables click on New
- Enter variable name as TOMCAT_HOME with a value C:\Java\tomcat
- Repeat steps iii and iv for all of the variable names and values listed below. Bear in mind if you've changed the installation folder you have to change the values respectively.
Environment variables
Name |
Value |
TOMCAT_HOME |
C:\Java\tomcat |
CATALINA_HOME |
%TOMCAT_HOME% |
JAVA_HOME |
c:\Java\jdk |
J2EE_HOME |
C:\Java\sdk |
PATH |
.;%JAVA_HOME%\bin;%J2EE_HOME%\bin;%CATALINA_HOME%\bin; |
CLASSPATH |
.;%JAVA_HOME%\lib\tools.jar;%CATALINA_HOME%\common\lib\servlet-api.jar;%CATALINA_HOME%\bin\bootstrap.jar; |
- Click OK in Environment Variables form
- Click OK in Properties form
- To check wheather Tomcat works properly run file C:\Java\tomcat\bin\startup.bat to start tomcat. In the end of the text output is should say INFO: Server startup in XXX ms.
- To stop Tomcat close console window or run file C:\Java\tomcat\bin\shutdown.bat
Michael V. Yudelson © 2010