There are many plug-ins available for the integration of tomcat with eclipse but most simple among them is “ Sysdeo Tomcat plugin ”. This can be downloaded from http://www.eclipsetotale.com/tomcatPlugin.html .
Step wise process to integrate tomcat using this plug-in is as follows:
- Tomcat should be pre-installed on the system. For further details click here.
- First step towards this process is, Download and unzip this plug-in in your eclipse plug-in directory.
- When you restart Eclipse IDE, Tomcat options(start, stop, restart) will start appearing on the Pane and in Menu.
- This plugin launches Tomcat using the default JRE selected in Eclipse “ Preferences ” window. To set a JDK as default JRE for Eclipse open the preference window: “ Window ” – > “ Preferences ” – > “ Java ” – > “ Installed JREs ”. The selected JRE must be a JDK (Tomcat require JDK to compile files instead of JRE).
- Next step involve setting of tomcat path at “ Window ” – > “ Preferences ” – > “ Tomcat”.
- Now it is ready to be used. To test our integration we can make a Servlet or JSP. Select “ File ” – > “ New ” – > “ Project ” and select the new entry Tomcat Project under Java, then press “ Next ”.
- Give project a name.
- Select the context and finish it. Now create a new file in this project, By selecting “ File ” – > “ New ” – > “ File ” option and give it the name “ Test.jsp”.
- Write this simple code in file and save it.
- Now start tomcat from menu “ Tomcat” – >“ Start ”. Its logo will start appearing in Eclipse console.
- Open a web browser and go to the URL. A page will load and you will get the figure like this.
<%@ page language = "java" %> <%@ page contentType = "TEXT/HTML" %>
If this page is being seen in a web browser, it means integration of Tomcat and Eclipse is complete.