`
丶安颜丨
  • 浏览: 16371 次
  • 性别: Icon_minigender_1
  • 来自: 淮安
社区版块
存档分类
最新评论

MyEclipse将java项目改为web项目

    博客分类:
  • Java
阅读更多

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项目图标

 

  • 大小: 677 Bytes
  • 大小: 423 Bytes
分享到:
评论
1 楼 longhua2003 2015-01-07  
我来试一下,如果有用,就太好了

相关推荐

Global site tag (gtag.js) - Google Analytics