You want to automate some of the Tomcat processes, such as starting and stopping Tomcat, as well as debugging Tomcat projects.
Use a Tomcat plug-in such as the Sysdeo plug-in. Download the plug-in from http://www.sysdeo.com/eclipse/tomcatPlugin.html, and expand it in the Tomcat plugins directory. It'll add buttons to the Eclipse toolbar for starting and stopping Tomcat.
The Sysdeo plug-in enables you to start and stop Tomcat from inside Eclipse, and you can download it for free from http://www.sysdeo.com/eclipse/tomcatPlugin.html. You install this plug-in by expanding it in the Tomcat plugins directory, then activate it by selecting Window Customize Perspective, expanding the Other node, and clicking Tomcat, as shown in Figure 11-10.
Figure 11-10. Configuring the Tomcat plug-in
| || |
For more on installing, using, and creating plug-ins, see the next two chapters.
As shown in Figure 11-11, this adds a new Tomcat menu to Eclipse and adds three Tomcat buttons to the Eclipse toolbar you can see under the Navigate menu; these buttons start, stop, and restart Tomcat.
Figure 11-11. Tomcat menu and buttons in the toolbar
You also need to connect the plug-in to your installation of Tomcat. Do that by selecting Window Preferences, which opens the Tomcat node. Browse to your installation of Tomcat by clicking the Browse button next to the Tomcat home box, as shown in Figure 11-12.
Figure 11-12. Configuring the Sysdeo Tomcat plug-in
This plug-in can handle the details of storing your files in the Tomcat installation if you create a Tomcat project. Just select File New Project and click Tomcat Project as the type of project, as shown in Figure 11-13.
Figure 11-13. Creating a Tomcat project
As shown in Figure 11-14, your project files will be created in the correct Tomcat directories, which will appear in the Package Explorer.
Figure 11-14. A new Tomcat project
The Sysdeo Tomcat plug-in also enables you to debug Tomcat projects as they're running, using the Eclipse debugger. That's extremely useful for web development because otherwise , all you have to track down errors with are the oblique Error 500 Server Error messages Tomcat shows in your browser.
11.10.4 See Also
Chapter 9 in Eclipse (O'Reilly).