Running Tomcat 6S2C Home « Running Tomcat 6

In the previous lesson we downloaded, verified and installed the Tomcat 6 server on our hard drives, but where is the server and how do we run it? In this lesson we will answer these questions as we look at starting up, testing and shutting down the Tomcat 6 server gracefully. Before we do this lets have a look at the unzipped files. So double click on the folder where you extracted Tomcat 6 to, which in our using Windows 7 example was the C:\apache-tomcat-6.0.37 directory. You should see files within the folder like the screenshot below:

Tomcat6 directory

The files within the bin directory are what are of interest to us now, so double click on the bin folder and you should see files within the folder like the screenshot below:

Tomcat6 bin directory

Setting A Classpath To The Java SDKgo to top of page Top

We need to point Tomcat 6 to a java SDK and so we need to add a new environment variable called JAVA_HOME and a classpath entry. We downloaded a java SDK in the Java section of the site and in our case the SDK was installed to C:\Program Files\Java\jdk1.7.0_07\. Below is a screenshot of how this is achieved on my Windows 7 system and of course other OS will vary. But for Windows 7, from Control Panel, select System >> Advanced System Settings and at the bottom of the window select Environment Variables. Create a new system variable called JAVA_HOME and add C:\Program Files\Java\jdk1.7.0_07\ as the value (or whatever you selected as your filepath to the SDK).

environment settings

Once you have done this press OK on the windows to close them all.

Starting Up Tomcat 6go to top of page Top

Ok with our new systen variable set up the first thing we need to do is open a command prompt and change the directory to the location of our Tomcat 6 bin directory and then type in startup (Windows 7) or startup.sh (Linux/Unix/OSX). Press Enter and the Tomcat 6 server should open up in a new window as shown by the following screenshot:

Tomcat6 startup

Testing Tomcat 6go to top of page Top

Now all we need to do to test our installation is running correctly is to go to a web browser and type in http://localhost:8080/ in the navigation bar and press enter. If all is well we should see the Tomcat welcome page as shown in the following screenshot:

Tomcat6 welcome page

Shutting Down Tomcat 6go to top of page Top

To shutdown our Tomcat 6 server make sure you're in the bin directory and then type in shutdown (Windows 7) or shutdown.sh (Linux/Unix/OSX). Press Enter and the Tomcat 6 server, and the server window opened on startup, will gracefully close as shown by the following screenshot:

Tomcat6 shutdown

Lesson 2 Complete

We have started up, tested and shutdown Tomcat 6, which we can now use for testing our Servlet 2.5 classes and JSP 2.1 pages.

What's Next?

In the next lesson we look at downloading the tools required to get the latest version of Tomcat 6 for Eclipse.

go to home page Homepage go to top of page Top