RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


A Quick Guide to Installing Tomcat on Windows  : Page 3

Get started using Java Server Pages (JSP) by installing the Open Source Jakarta Tomcat Servlet and JSP container.


Step 2: Start the Server
After unzipping the file, navigate to the "bin" directory and start Tomcat by running the startup.bat file. You must have the JDK installed before you can start Tomcat. The JDK contains the Java runtime engine. The environment variable JAVA_HOME tells Tomcat where to find your JDK. You can set this variable from the Control Panel or by modifying the file tomcat.bat in the bin directory. Simply add a line at the beginning of the file to point to your JDK installation. For example, if you installed the JDK in the c:\jdk1.2 directory, you would write:

   SET JAVA_HOME=c:\jdk1.2
The other important environment variable is called CLASSPATH. The CLASSPATH variable helps the Java runtime find various classes needed by an application. Usually, these Java classes are grouped together in a single JAR (Java Archive) file. Tomcat has several such JAR files that include classes for XML parsing, Servlets, and the JSP compiler. You can find them in the "lib" directory. Tomcat automatically appends the location of its jar files to your existing CLASSPATH.

Warning: Sometimes the process of appending the jar file location to your CLASSPATH environment variable causes the variable size to exceed the maximum allowable size. The tomcat.bat file contains a description of how to make the appropriate modifications manually.

Another point to consider is that JSP pages must be compiled the very first time someone accesses the JSP page. This compilation process converts the JSP page into a Servlet. This requires access to the Java compiler. Tomcat will not be able to call the Java compiler if the directory path to the Java compiler includes spaces. To avoid the problem, install the JDK in a directory with a name that contains no spaces, such as JDK1.3.

Figure 2. Tomcat Introduction Page : You'll see this page if Tomcat has successfully installed.
After starting Tomcat, open your browser and type the following URL: http://localhost:8080. Tomcat uses port 8080 by default, so make sure that port is not being used by another server, such as Internet Information Server (IIS). If there is a port conflict, you can change Tomcat's default port by modifying the file server.xml in the conf directory. Search for the number 8080 in the file and change it to an unused port number. When Tomcat starts successfully, you will see an introduction page in your browser similar to Figure 2.

There are two links towards the middle of the page pointing to Servlet and JSP examples. You should click on a few examples to make sure everything is working correctly.

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date