Download an Application Server

Home | Register a Domain Name >>

Step 1. Get a free application server such as Apache Tomcat. I prefer to use Apache Tomcat as my application server. Apache Tomcat is an open source project - meaning that anyone can download it, its source code, and use it. At the time this book was written the latest version of Tomcat was 6.0.10.

To download Tomcat go to the Apache Tomcat download page. You can download Apache Tomcat from http://tomcat.apache.org/.

You will probably only need the Binary Distribution unless you plan on modifying the source behind the application server. Click on the link to the Core Download that is appropriate for you. I use Windows to host my websites so I downloaded the zip version. You may also use the Windows Service Installer.

Once the download has completed successfully unzip/untar the file. I recommend unzipping to a location on your computer that does not include spaces such as C:\Tomcat. After you have extracted the files you are ready to go!

To verify that your instance of Tomcat is working correctly, go to the bin directory under the file structure to which you extracted the files. Then select the Tomcat executable file by double clicking on it in Windows.


If a command prompt window flashes but you do not see a message, assume that there was an error. To view the error message you will need to open a command prompt and run the startup command by hand.

In the above example the Java JRE is not defined so Tomcat will not run. So, what does this mean? You will need to install a Java JDK and set your JAVA_HOME environment variable.

If you did not have an error, skip to the next section.

To install a JDK go to Sun’s Java Download site. Look for a J2SE JDK (Java SE Developer’s Kit).

You should see this:


Once the file is downloaded choose a custom install so that you can choose the Install directory. Again choose a directory without any spaces. For example, we installed Java to C:\Java\jdk1.6.0\. You can leave all of the defaults for the remainder of the options. Click Next to start the installation.Once the download is complete, go to the location where you installed the JRE to verify that it is installed. Once installed, right click on the My Computer icon and choose Properties. In the System Properties window that opens click on the Advanced Tab.Then choose the Environment Variables button.

The Environment Variables Window will open. Under the System variables make sure that you have a variable called JAVA_HOME. If you do not have this variable, you will need to create a one by clicking on the New button.

Under Variable name type JAVA_HOME and under value fill in the location in which you saved your JRE.

Click OK until you are completely out of the System Properties window.

Now try running the startup command again.
If you see a message like this



You have downloaded a Sun JRE not a JDK. A JDK is a Developer’s Kit which may be used to compile Java code. For Tomcat to work, JDK is essential, as it must know how to compile Java Servlets and JSP pages.Go back to the download page and try again. You should see something like this when Tomcat starts up successfully:


Verify that your server is up and running by opening a web browser and typing:

http://localhost:8080 into the URL field.

You should see:

Congratulations! You have successfully downloaded and installed your application server!

Step 2.Getting your content ready for the world to see. style="background: red;Grab your files whether html files, images, or an entire web application complete with JSP pages and Java Servlets and put them in the webapps\ROOT directory. Notice that this directory will already have some files in it. These are the default Apache Tomcat files that render the page shown above.   Now refresh the browser and you should see your files. style="background: red;You may need to navigate directly to the URL field if you do not have an index.html page.   For example if you had a file named test.html style="background: red;type http://localhost:8080/test.html into the URL field.

Note: The default port for Tomcat is 8080.You can change it in the config/server.xml file by changing it from:
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector port="8080" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" />

to:
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector port="80" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" />

This would allow you to simply type: http://localhost/test.html instead of the port.

Home | Register a Domain Name >>