Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2536720
  • 博文数量: 245
  • 博客积分: 4125
  • 博客等级: 上校
  • 技术积分: 3113
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-25 23:56
文章分类

全部博文(245)

文章存档

2015年(2)

2014年(26)

2013年(41)

2012年(40)

2011年(134)

2010年(2)

分类: Java

2011-11-14 13:06:06

当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 Project


1) 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
  1. <buildCommand>
  2.         <name>org.eclipse.wst.common.project.facet.core.builder</name>
  3.         <arguments>
  4.         </arguments>
  5.     </buildCommand>

3) Copy “web project” facet nature and paste within “java project” .project natures tag

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


谢谢访问!

阅读(1936) | 评论(0) | 转发(0) |
0

上一篇:DatagramSocket 与 UDP

下一篇:REST Web Services

给主人留下些什么吧!~~