MyEclipse將java專案改為web專案
阿新 • • 發佈:2018-12-31
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專案圖示