...
That's it, Tomcat will actually run and start if you run it from the command line, however, Windows is not designed to run command line applications so see the next section.
Automatic Startup and Shutdown of Tomcat
In Windows, you probably want to make use of Windows Services to automatically startup, shutdown and even stop and start Tomcat.
Code Block |
---|
cd C:\opt\apache-tomcat-6.0.26-a_32-bit\bin
service.bat install "Tomcat instance tomcat-a" |
We have now added Tomcat as a service to the windows registry. However, there is no reference yet to what version of java should be used with the service.
We will now issue commands to update the registry. If you want to see the updates in real time Start the registry,
- Click Start, Run
- Type, regedit and hit Enter to see the registry
- Click Edit, Find
- Search for tomcat-a
Now, we will update the registry to point to a specific version of Java,
Code Block | ||
---|---|---|
| ||
cd C:\opt\apache-tomcat-6.0.26-a_32-bit\bin
tomcat6.exe //US//Tomcat6a --JavaHome=C:\opt\jre1.6.0_20_32-bit
tomcat6.exe //US//Tomcat6a --Jvm=C:\opt\jre1.6.0_20_32-bit\bin\client\jvm.dll
|
Tomcat Icon on System Tray
Finally, you can add Tomcat to the Windows System Tray.
First open notepad and put in the following text changing the particulars to your particular instance of Tomcat,
Code Block |
---|
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"ApacheTomcatMonitora"="\"C:\\opt\\tomcat\\bin\\tomcat6w.exe\" //MS//Tomcat instance tomcat-a" |
Save the file as Tomcat6a-system-try.reg
Put the file on the server and double-click the file. you will be prompted with a warning dialog as this is modifying the windows registry.
Log off and log on again. You should see the Tomcat Icon named to your particular instance in your system tray.
The registry entry equates to automatically running the following command upon login,
Code Block |
---|
tomcat6w.exe "//MS//Tomcat instance tomcat-a" |
Finally log out and log back in. You should now see the tomcat icon on the system tray.
References
http://tomcat.apache.org/tomcat-6.0-doc/windows-service-howto.html#Tomcat6w - Background on how to add to system try.