DekGenius.com
Previous Section  < Day Day Up >  Next Section

Recipe 11.10 Using a Tomcat Plug-in

11.10.1 Problem

You want to automate some of the Tomcat processes, such as starting and stopping Tomcat, as well as debugging Tomcat projects.

11.10.2 Solution

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.

11.10.3 Discussion

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
figs/ecb_1110.gif


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
figs/ecb_1111.gif


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
figs/ecb_1112.gif


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
figs/ecb_1113.gif


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
figs/ecb_1114.gif


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).

    Previous Section  < Day Day Up >  Next Section