Installing Tomcat 6 on Windows 7

Tomcat is an open source Java Servlet container developed by the Apache Software Foundation. It is bundled with a very capable Java based Web (HTTP) Server.

Which Java to install ?

Tomcat requires Java to be installed – it is afterall a Java Servlet container. Since Tomcat 5.5 the dependency on the JDK (Java Development Kit) for compilation of JSPs (Java Server Pages) has been removed. The Eclipse JDT Java compiler has been bundled with Tomcat to provide this capability. This means that we just need to install the JRE (Java Runtime Environment).

So its a simple decision then – or is it ?

Java Virtual Machines

From the Oracle Java SE Documentation:

The JDKTM provides one or more implementations of the JavaTM virtual machine (VM):

  • On platforms typically used for client applications, the JDK comes with a VM implementation called the Java HotSpotTM Client VM (client VM). The client VM is tuned for reducing start-up time and memory footprint. It can be invoked by using the -client command-line option when launching an application.

  • On all platforms, the JDK comes with an implementation of the Java virtual machine called the Java HotSpot Server VM (server VM). The server VM is designed for maximum program execution speed. It can be invoked by using the -server command-line option when launching an application.

The above documentation and information from other resources on the differences between the Client VM and Server VM suggest that we should be using the Server VM when running Tomcat on a server.

Unfortunately the Server VM is only bundled with the JDK. So we are back to our dependency on the JDK. If you are installing Tomcat on a server and require the optimisations around speed and for long lived processes install the JDK and use the Server VM.

Which Tomcat Binary Distribution ?

Just when you thought it was getting simpler … The Tomcat 6 Downloads page has 6 options for binary distributions.

Pick the 32-bit/64-bit Windows Service Installer option. This distribution is geared towards users planning to launch Tomcat through Windows services and also provides the compiled APR/native library.

Installing

Download and install the Java 6 SE JDK. Remember to install the 64-bit version if you are running on a 64-bit OS. The Tomcat installer will look for a 64-bit Java VM on a 64-bit OS.

Download and install the Tomcat 6.0.29 32-bit/64-bit Windows Service Installer.

Ensure that you select the Service and Native options under the Tomcat component. The Manager application component provides a web based management application.

 Tomcat 3

You will be asked to choose an HTTP connector port for Tomcat and if you chose to install the Manager component you will also be required to configure authentication details for the Manager.

Tomcat 5

When asked to provide the path to the java virtual machine to use, specify the JRE folder of the installed JDK.

Tomcat 6

When the install is complete, the Tomcat service will be automatically started if you chose Run Apache Tomcat in the final screen on the install wizard.

Tomcat 9

Confirm the install

Once the service has started, the Tomcat icon should appear in the taskbar. Right click the icon and select Configure from the menu.

Tomcat 10 Tomcat 11

 

Select the Java tab on the Apache Tomcat 6 Properties window. Confirm that the Server VM (jre6\bin\server\jvm.dll) is being used by Tomcat.

Tomcat 12

Open the Windows Services manager and confirm that the Tomcat service has been correctly installed.

Tomcat 14

Finally confirm that you can communicate with Tomcat on the configured HTTP port. Open http://localhost:8080 in your browser.

Tomcat 15

About these ads

60 thoughts on “Installing Tomcat 6 on Windows 7

  1. Thank you for your reply,

    I downloaded Tomcat 6.0.29, then I extracted it in a folder, after that I does not found an exe file that permit me to install it,
    I double clicked on file catalina (under bin), also the file startup (under bin) but it does not work,
    I haven’t an exe file that permit me to launch the installation

    Thanks

  2. I forget to notice that in the run of windows 7, it shows a msgBox that says:
    Unable to open service topmcat6
    Have you any idea about this
    Thanks

  3. Thanks a lot your post was very usefull….??

    However i have a new problem when i click on “configure tomcat” in All programs to start/stop the server my screen resolution changes… same repeats even when i click on “monitor tomcat”.

  4. when i clicked the config/monitor tomcat in Allprogrames it shows access is denied.
    i am using tomcat6.0.32 and jdk6 in my windows7

    • Check that the Apache Tomcat 6 service is running via the Windows Services Management Console.

      If the service is running and you still cannot connect then check that the configured port for tomcat is correct. Check in the %TOMCAT_INSTALL_FOLDER%/conf/server.xml file for the port value in the tag under .

  5. Tomcat seems to work perfectly fine for me but connecting it to an Oracle Database is causing huge headaches!

  6. Hi….just incase this helps…..noticed that service name on my windows 7 install is tomcat6…not “Apache tomcat 6″ as shown in screen above.

    Not sure if this is specific to my installation, but thought it worth mentioning in case anyone else is looking for the more verbose service name.

    • Generally the longer DisplayName property on the service is used in the service console. I’m not sure why you are seeing the shorter Name property …

      
      PS C:\> Get-Service | where { $_.Name -match "tomcat"}
      
      Status   Name               DisplayName
      ------   ----               -----------
      Running  Tomcat6            Apache Tomcat 6
      Stopped  Tomcat7            Apache Tomcat 7
      
    • As per the reply to Mohammed Aleem:

      Check that the Apache Tomcat 6 service is running via the Windows Services Management Console.

      If the service is running and you still cannot connect then check that the configured port for tomcat is correct. You can get the configured port in the %TOMCAT_INSTALL_FOLDER%/conf/server.xml file by checking the port attribute’s value in the Connector tag at the following XPath location – /Server/Service[@name=”Catalina”]/Connector[@protocol=”HTTP/1.1″ ].

      • Paul,

        Thank you for all the information you have in here. It is definitively very useful. I have the same problem than manolis and Mohammed. Basically when I try to open http://localhost:8080 I get the webpage not found error, but the apache icon still shows up in the inferior right corner. I went to the file you said and I get this from there: “Connector port=”8080″ redirectPort=”8443″ connectionTimeout=”20000″ protocol=”HTTP/1.1″/”. So I am assuming the port 8080 is correct. I have installed tomcat 6.0.33 in a windows 7 professional machine. I have tried giving the tomcat executable administrator privileges (right click, compatibility), I have tried installing tomcat 7, I have tried restarting the machine multiple times, I have tried both installing jre 7 and jdk 7, I have tried starting tomcat from eclipse. Nothing seems to work. I feel that I am running out of ideas. Any suggestion ?

        Boris

    • Are you using Internet Explorer when trying to get to the http://localhost:8080 URL ? If so, make sure you are using the http:// prefix – IE doesn’t seem to route correctly without it.

      Otherwise try Chrome and see if you have the same issue.

      • Paul,

        Thank you for your answer. I should have mentioned that I though about that and I included the prefix “http://” when trying to access the server from IE, additionally I went ahead and I installed Chrome. It is interesting that in IE I get the bad request error, but in Chrome I get a blank page that only says “fail”. Additionally, I should mention that I added the variable %JAVA_HOME% to the environment variables and to path, but not success yet. Any ideas ?. Thanks,

        Boris

  7. Paul

    Great blog. I am attempting to install Tomcat7 on a Win7pro machine. Installation went fine and the installer was able to start the service. As part of the installation for the specific webapp I am trialling however, I had to stop the service (which was done via the Tomcat monitor). I made some config changes using the monitor, specifically adding

    -XX:PermSize=128m
    -Xincgc

    \ also the initial mermory pool and maximum mem pool to 512M

    However when I restart the service using either windows service manager or Tomcat Monitor. The service simple enters a “Starting” state, never reaching the Started state. In this state it will not respond to stop commands or most other commands using sc.exe.

    Any advice for debugging the installation.

    • Ben

      Make sure that any Java options entered in the Tomcat Monitor’s Java Options text box do not have trailing whitespace – this has caught me out before.

      If that still doesn’t help your best bet is to look in the latest %TOMCAT_INSTALL_FOLDER%/logs/catalina.*.log file to determine why tomcat is not starting up.

  8. Thank you Paul. Your info pushed me out of the rut I have been for the past couple of hours. Maybe you can help the Apache/Tomcat group with clearer installation steps on their website :)

    Have a great one!

  9. hi
    I have install tomcat on my window 7 machine,when typing localhost:8080 on i.e its showing unsuccessful but with chrome its showing installed

    • I seem to have the same issue with IE – you need to specify the http:// prefix otherwise IE does not seem to be able to route correctly to the site.

    • hi manohar 404 error can b seen if u assign wrong url pattern at address bar of browser window. .Hope so So, one please confirm the and check 1s again c dat your servlet class matches with dat of your web resource prog’m and servlet name also both in servlet tag & servlet mapping.(check in web.xml) ex:http://localhost:8585/webappication_name/url-pattern if web server resides within your system

  10. Worked exactly the same way for Tomcat 7. Apache Tomcat sit does not make it clear that the installer needs to be downloaded too to make everything smooth.

    Your post made it simple
    Thanks,
    ChuckInAtl

  11. After some initial steps i partially installed apache in my lap but i have one doubt in configure tab in apache property window the path should like this C:\Program Files\Java\jre1.6.0_01\bin\client\jvm.dll instead C:\Program Files\Java\jre1.6.0_01\bin\server\jvm.dll is this mean i had not installed my java properly?

    • It means that the installer didn’t pick up the Server VM – ensure that you have the JDK installed not just the JRE. Read the beginning of the post.

  12. Thank You

    You helped me sort out a problem which i am facing nearly 10 hours.
    As a .net programmer i don’t know much about tomcat server,You guided me to install it in my pc.

  13. hey … i downloaded tomcat 6..but i cudnt find startup file to run it in bin folder…
    i downloaded “32-bit/64-bit Windows Service Installer” only…
    plz help me out

    • The Windows Service Installer installs Tomcat as a Windows Service and does not provide startup files in the bin folder. It is geared towards interacting with Tomcat via the Windows Service mechanisms.

  14. One thing to keep in mind (that I ran into) is if you’ve already installed Oracle before this, it will hog up port 8080, which is the standard port that Tomcat uses. I tried editing the server.xml file, but it wouldn’t let me save it, even when I shut down Tomcat. So I just uninstalled and reinstalled using port 8181. Just some food for thought.

  15. Hi Paul,

    Your directions on how to install Apache Tomcat 6 on Windows 7 are by far the best. I am lucky this turned up at the top of my google search. Thanks to this page I did it in less than 5 minutes with confidence. Just telling me which of the 6 binary files to download was the best starter, and then having the screen shots to guide me along. Thank you very much. It was a pleasure.

    ~Trees

  16. really your detailed description helped me a lot…. i was searching for a better answer for this installation for last 1 week…. thanks a lot Mr.Paul

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s