Java Tutorial - Java Script : Installing Tomcat on Windows

Java Tutorial - Java Script :

Installing Tomcat on Windows


The best way to install Tomcat on Windows is to download the self-installing executable file. This program works like many Windows installer programs and should be easy to use. The first thing the installer does is detect the JDK. If you have more than one version of the JDK, make sure to note whether the one it finds is the one you want Tomcat to use and click OK. The next screen is the license screen. Accept the license by clicking OK. The next screen provides the installation options. The Normal option is fine for most users. If you want Tomcat to install itself as a Windows service then you should check the NT Service box. We do not recommend this for development purposes, but if you were to configure a Windows-based production server you would want to do this to ensure that Tomcat ran whenever Windows was restarted. Click Next to move to the next dialog box. This dialog box allows you to select the directory that will be used to install Tomcat. The default for this is C:\Program Files\Apache Group\Tomcat 4.x. This is an unfortunate choice as a default selection. Often Java programs have difficulty dealing with spaces embedded in directory and filenames. We recommend that you change the default directory and use one that does not have mixed case or spaces. Our choice is normally c:\jakarta\tomcat4.x. Selecting install will begin the installation process. After the files are copied, you will be prompted for a connection port. The default of 8080 is fine unless you are running another servlet container (Jetty for example) on the port. You are also prompted for an administrator password. Be sure to enter one that you will remember. For later examples, we will use adminpasswd as the password. After this is done the installation will complete. Click Close to end the program. The install program adds the menu Start Programs Apache Tomcat to the Start menu. This menu provides convenient shortcuts to the Tomcat documentation and to start and stop the servlet container. To start Tomcat, click the Start button and choose Programs Apache Tomcat Start. A command prompt window will open with output similar that shown in Figure 5.5.

Test the configuration by opening your browser and pointing it to: http://localhost:8080
You should see the response shown in Figure 5.6. We should also test to make sure that JavaServer Pages are working. To do this, click the JSP Examples link on the startup page or enter the following URL: http://localhost:8080/examples/jsp/index.html This will provide a list of JSP examples that are installed in Tomcat. We suggest that you try the snoop example and make sure that it works. Snoop returns information about the HTTP request that invoked the page.