A few months ago I wrote a high level article about a number
of confusing Java things in an attempt to make them simple for web programmers
getting started with Java (see Java:
Confusing Things Made Simple - What You Need to Get Up and running). In this article I am going to take you one
step further. That is, getting your
local development environment set-up and ready to start developing for your
intranet using Java and JSP.
Although there are numerous different web servers and
servlet engines to choose from, in my example I am going to walk you through
setting things up using Apache and Tomcat on a Windows platform. The reasons are twofold. Firstly, both are open-source software, so
anyone can use them, even those on a shoestring budget. Secondly, it is the environment I am
currently involved with migrating our intranet to, so I am most knowledgeable
about it (relatively speaking).
To start, you will need to install the latest Java
Development Kit (JDK). It is available
from the source for all things Java website at http://java.sun.com/. Simply download and follow their installation
instructions and set your PATH and CLASSPATHS accordingly as I described in my
previous article.
Once you have the Java environment installed and configured,
it is time to obtain, install, and configure the web server pieces.
Get the Software
First, download, and save to a convenient place on your
local machine, Apache and Tomcat from http://www.apache.org. For this test, I downloaded Apache HTTP
Server version 1.3.22 for Windows (http://www.apache.org/dist/httpd/binaries/win32/apache_1.3.22-win32-x86.exe). Note I only downloaded the binaries as I
have no need (or desire) to peruse the source code or do my own build. For Tomcat, I downloaded version 3.3
(http://jakarta.apache.org/builds/jakarta-tomcat/release/v3.3/bin/jakarta-tomcat-3.3a.zip).
You also need to download the files needed to create the
Communication Bridge between Apache and Tomcat. In my example I downloaded the JServ module which consists of the
ApacheModuleJServ.dll. You can find
that at
http://jakarta.apache.org/builds/jakarta-tomcat/release/v3.3/bin/win32/i386/
and you can either download the .DLL file directly or a zip file which contains
it.
Install the Software
The goal here is to first install and test both Tomcat and
Apache separately before performing any integration configurations.
Tomcat
1.
Extract the jakarta-tomcat-3.3a.zip file to the root of your
local machine. The extract will
automatically make a jakarta-tomcat-3.3a folder for you. I renamed the folder to make it simple
jakarta-tomcat (without the version number) for simplicity sake.
2.
You can either set your system environment variables manually,
or create a handy-dandy batch file to run from your desktop. The main key is that you want to set the
following variables to what exists on your machine:
JAVA_HOME=c:\jdk1.3.1
TOMCAT_HOME=c:\\jakarta-tomcat
3.
Start
Tomcat. Again, a handy-dandy batch file
to run from your desktop is the way to go because you will be starting and stopping both Apache and Tomcat a lot.
The commands looks thusly:
cd
c:\jakarta-tomcat\bin
CALL
startup
4.
Open your
browser and type http://localhost:8080.
(By default Tomcat runs on port 8080).
This will bring up the default page that comes with the Tomcat
installation. If you see the following
screen, you have Success!

5.
Stop Tomcat
using a batch file or following commands:
cd
c:\jakarta-tomcat\bin
CALL
shutdown
Apache
1.
Execute the
apache .exe file you downloaded. This
will launch Windows Installer which makes Apache installation a breeze.
2.
Accept all
the defaults.
3.
When you
see the following screen, enter information specific to your machine. I chose
not to run it as a service, but rather start it manually.

4.
Set your environment variables (see # 2 under the Tomcat
installation)
5.
Start Apache. Again, a batch file will make your life easier.
The commands are as follows:
cd C:\program files\Apache group\Apache\bin
start "Apache 1.3.12" Apache.exe
6.
Open your browser and type http://localhost. This will load the default home page as
installed by Apache.
7.
If you see the following screen, you have Success!

8.
Stop Apache using a batch file or with the following commands:
cd C:\program files\Apache group\Apache\
Apache -k shutdown
Onto Page II -
Configure
Go to page: 1 2