< Day Day Up > |
Recipe 11.10 Using a Tomcat Plug-in11.10.1 ProblemYou want to automate some of the Tomcat processes, such as starting and stopping Tomcat, as well as debugging Tomcat projects. 11.10.2 SolutionUse 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 DiscussionThe 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
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 toolbarYou 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-inThis 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 projectAs 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 projectThe 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 AlsoChapter 9 in Eclipse (O'Reilly). |
< Day Day Up > |