1. Download Tomcat from the official website.Source codeIn this example, apache-tomcat-6.0.35-src.zip is used.
2. Create an empty Java project in eclipse named apache-tomcat-6.0.35-src (casual ).
3. Copy all files in the source code to an empty project.
4. Use the conf, Java, and test folders as source folder.
5. During compilation, some errors will be reported. After necessary jar and JUnit lib are added, the compilation is successful.
Project preview:
. Classpath File
<? XML version = "1.0" encoding = "UTF-8"?> <Classpath> <classpathentry kind = "src" Path = "conf"/> <classpathentry kind = "src" Path = "Java"/> <classpathentry kind = "src" Path = "test"/> <classpathentry kind = "con" Path = "org. eclipse. jdt. launching. jre_container/org. eclipse. jdt. internal. debug. UI. launcher. standardvmtype/JavaSE-1.6 "/> <classpathentry kind =" lib "Path =" lib/ant. jar "/> <classpathentry kind =" lib "Path =" lib/jasper-jdt.jar "/> <classpathentry kind =" lib "Path =" lib/jaxrpc. jar "/> <classpathentry kind =" lib "Path =" lib/wsdl4j-1.5.1.jar "/> <classpathentry kind =" con "Path =" org. eclipse. jdt. JUnit. junit_container/4 "/> <classpathentry kind =" output "Path =" bin "/> </classpath>
Find Org. apache. catalina. startup. bootstrap class to run tomcat.