1. eclipse工程中.classpath文件含义:
下面是一个.classpath文件内容:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<!-- 源码目录 -->
<classpathentry kind="src" path="src"/>
<!-- 工程引用外部lib目录(最好用相对路径) -->
<classpathentry exported="true" kind="lib" path="applets/dom4j-1.6.1.jar"/>
<classpathentry exported="true" kind="lib" path="applets/commons-email-1.2.jar"/>
<classpathentry exported="true" kind="lib" path="applets/poi-3.7-20101029.jar"/>
<classpathentry exported="true" kind="lib" path="applets/poi-ooxml-3.7-20101029.jar"/>
<classpathentry exported="true" kind="lib" path="applets/poi-ooxml-schemas-3.7-20101029.jar"/>
<classpathentry exported="true" kind="lib" path="applets/xmlbeans-2.3.0.jar"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<!-- JDK编译时容器,建立好java项目后自动产生的 -->
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_43"/>
<!-- class 目录,对于web工程的path就是WebRoot/WEB-INF/classes了 -->
<classpathentry kind="output" path="bin"/>
</classpath>
一般当下载好一个源码包后,我们就可以新建java工程,然后进行导入,接着把源码包中的eclipse.classpath中的内容复制到我们新建的java工程中的.classpath文件中。这时我们就可以编译项目了,一般在这里都会出现问题(如果引用到了外部的jar文件,这个可以在.classpath文件中查看),就是lib中的jar文件没有,或者名字跟.classpath文件中描述的不同。那么编译是就会提示***包不存在。此时我们就要手动的修改lib目录下jar文件的名字了,是它们与.classpath文件中一致即可。
2.eclipse工程中.project文件:
<?xml version=”1.0” encoding=”UTF-8”?>
<projectDescription>
<!-- 工程名称 <name>-->
<name>execlInterface</name>
<comment></comment>
<projects></projects>
<!-- 编译器指定 <buildSpec>-->
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments></arguments>
</buildCommand>
</buildSpec>
<!-- 核心特性 <natures> -->
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
3.对于myeclipse工程多了一个(web 应用程序才有)
.mymetadata文件:
<?xml version=”1.0” encoding=”UTF-8”?>
<!--
type : 工程类型
name : 工程名称
id : 工程在工作空间内的唯一标识
context-root : 网站根路径
j2ee-spec: J2EE标准
archive : 打包后war文件
-->
<project-module
type=”WEB”
name=”upload”
id=”myeclipse.1152954865843”
context-root=”/upload”
j2ee-spec=”1.4”
archive=”upload.war”>
<attributes>
<!-- value : Web根目录名称 -->
<attribute name=”webrootdir” value=”WebRoot” />
</attributes>
</project-module>
在 eclipse 更改工程的发布文件夹
可以在自己的 workspace 中找到当前使用的工程,找到文件 .mymetadata ,打开后就会看见标签 context- root=”/example” ( example 是自己应用的名称),可以将其改为别的名称,另外也可以在 eclipse 中改:选中要修改的 project ,之后在菜单 project 中选中 properties ,选中 Myeclipse-Web ,就可以看见标签 context-root 即可修改