How to install service for Tomcat 6.x/7.x to start automatically after reboot on Windows 7 or Windows Server 2008?
First of all, you will need administrator privileges to install service. This step by step guide is for standalone zip version of Tomcat Server.
- Navigate to the
bin
folder of your tomcat installation. You should have in folder three files among others:service.bat, tomcat7.exe
andtomcat7w.exe
. If you are using older Tomcat Server than these files should betomcat6.exe
andtomcat6w.exe
.
service.bat tomcat7.exe
tomcat7w.exe - If these files are not there then you have to manually add them. First, figure out which version of Tomcat you have. Also, define architecture 32 bit/64 bit.
After that go to http://tomcat.apache.org/download-70.cgi or http://tomcat.apache.org/download-60.cgi and download the right zip file.
If you are using older versions than you have to look in
http://archive.apache.org/dist/tomcat/tomcat-7/ or
http://archive.apache.org/dist/tomcat/tomcat-6/ for the zip file. - In downloaded zip navigate to Tomcat
bin
directory and copyservice.bat, tomcatX.exe
andtomcatXw.exe
. files to your Tomcat installation. You can remove downloaded zip now ;). - Stop Tomcat Server if running.
- Open
cmd
with Administrator privileges and navigate to Tomcat’sbin
directory where you should now have all three files. - Run
service.bat install
. Your service should be installed with name Tomcat7 or Tomcat6.
Following instructions can be found here: http://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html. - After that run
tomcatXw.exe //ES//
(X is Tomcat major version) A new window should pop up.tomcat7w.exe //ES//
- The next step is important for successful running Tomcat with Windows service.
Increase “Initial memory pool” and “Maximum memory pool”. - Add new line “Java Options” section. This will increase Java heap size. This setting is very important as running Tomcat as service will override all other settings except those.
-XX:MaxPermSize=256m
- Start Tomcat as a service in Windows Services. Run
services.msc
or access it from Tak Manager (Services tab).
This way you can automatically run Tomcat Server after reboot without logged in user.
Related articles
- Tomcat (nikstricks.wordpress.com)
- Install Tomcat 7 on UBUNTU (cleanclouds.wordpress.com)
#apache-tomcat, #java, #java-servlet, #microsoft-windows, #windows, #windows-server-2008, #windows-service, #zip-file-format
Thanks!
Very helpful info and urls provided.
Hi. You said:
“3.In downloaded zip navigate to Tomcat bin directory and copy service.bat, tomcatX.exe and tomcatXw.exe. files to your Tomcat installation”.
But I have tomcat6w.exe and tomcat6.exe. What could I have done wrong ?
There is nothing wrong with “tomcat6w.exe” and “tomcat6.exe”.
The “X” is actually tomcat version, in your case 6.
Thanks!
how to view the initial and max memory pool using command line in windows?
Awesome !! Keep on good work !!