当eclipse不能识别一个web project的时候,如果使用run as --configuration--tomcat 则会抛出以下异常:
java.lang.NoClassDefFoundError: org/apache/catalina/startup/Bootstrap
将java project change to web project:
Once a project is created in Eclipse Europa of a certain type, it's not the most straight forward process of changing the project to a different type. For example you have a project that Eclipse considers to be a Java project, but it's actually a Web Project, you don't get to take advantage of all of the features available for Web Projects, such as deploying to a local tomcat server, unless Eclipse is aware that it's a web project. This has to do with the project settings and what eclipse considers the "Nature" of the project.Sometime we just need to convert our Java Project to Web Project in Eclipse IDE.
Here is some of the reasons you may need to convert Java Project to Web Project1) Create / import a wrong project type
2) Initial java project migrate to java web project
3) Maven create a Java Project (eclipse:eclipse), but we need a web project feature.
4) Others…?
No mater what reasons we need to convert java project to web project. Eclipse does not provide a feature to convert it automatically. We have to do it manually.
Here is the steps to convert Java Project to Web Project in Eclipse
1) Create a empty dynamic web project and click on the .project file
2) Copy “web project” facet buildCommand and paste within “java project” .project buildSpec tag
- <buildCommand>
-
<name>org.eclipse.wst.common.project.facet.core.builder</name>
-
<arguments>
-
</arguments>
-
</buildCommand>
3) Copy “web project” facet nature and paste within “java project” .project natures tag
- <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
P.S Be careful of the .project xml tag, make sure you paste into a correct location.
4) Save it.
5) Right click on Java Project, click properties.
6) Select Project Facets and click modify project button.
7) Click Dynamic Web Module and Java check box.
Finished, Now your java project has been converted into a web project.
阅读(1974) | 评论(0) | 转发(0) |