java application在myeclipse中的.project配置文件为
<?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>ProjectName</name> <comment></comment> <projects> </projects> <buildSpec> <buildCommand> <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments> </buildCommand> </buildSpec> <natures> <nature>org.eclipse.jdt.core.javanature</nature> </natures> </projectDescription>
将上面的文件打开后,替换为如下代码
<?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>ProjectName</name> <comment></comment> <projects> </projects> <buildSpec> <buildCommand> <name>com.genuitec.eclipse.j2eedt.core.WebClasspathBuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>com.genuitec.eclipse.j2eedt.core.J2EEProjectValidator</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator </name> <arguments> </arguments> </buildCommand> <buildCommand> <name>org.eclipse.wst.validation.validationbuilder</name> <arguments> </arguments> </buildCommand> </buildSpec> <natures> <nature>com.genuitec.eclipse.j2eedt.core.webnature</nature> <nature>org.eclipse.jdt.core.javanature</nature> </natures> </projectDescription>
其中ProjectName为你的项目名称
再将.classpath文件中的
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="WebRoot/WEB-INF/classes"/>
两个path改为你项目中对应的路径,其中src对应的path就是java项目中的src,
outpath 一般改为WebRoot/WEB-INF/classes,修改后的文件如下
<?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="con" path="melibrary.com.genuitec.eclipse.j2eedt.core.MYECLIPSE_JAVAEE_6_CONTAINER"/> <classpathentry kind="output" path="WebRoot/WEB-INF/classes"/> </classpath>
保存两个文件后,在myEclipse中刷新项目即可,这时,原来的java项目图标
就变成了web项目图标