文章轉載至:http://blog.csdn.net/hongchangfirst/article/details/7722703
web項目沒有run on server
1、首先確保正確安裝Tomcat和JDK。(eclipse要確保eclipse是javaee版本的,或者已經安裝看wtp插件 )
Tomcat安裝參考:http://jingyan.baidu.com/article/4853e1e53465271909f72690.html
2、找到對於web項目的文件夾,打開文件夾下.project文件
3、查看.project文件是否包含以下文件,如果沒有添加進去,修改后保存文件。
在 <natures> </natures>中加入
<natures> <nature>org.eclipse.jem.workbench.JavaEMFNature</nature> <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature> <nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.wst.common.project.facet.core.nature</nature> <nature>org.eclipse.wst.jsdt.core.jsNature</nature> </natures>
在 <buildSpec> </buildSpec>中加入
<buildSpec> <buildCommand> <name>org.eclipse.wst.jsdt.core.javascriptValidator</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>org.eclipse.wst.common.project.facet.core.builder</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>org.eclipse.wst.validation.validationbuilder</name> <arguments> </arguments> </buildCommand> </buildSpec>
4、刷新web項目,在項目->右擊->Properties->Project Facets->Modify Project,選擇Java和Dynamic Web Module。點擊ok關閉。
5、此時再打開run as 應該就有Run on server了。