1、ANT方式
buid.xml内容:
<project name="TestHadoop" default="compile" basedir=".">
<property name="build" location="build" />
<path id="hadoop-classpath">
<fileset dir="D:\Lab\lib\hadoop\hadoop-1.2.1/lib">
<include name="**/*.jar" />
</fileset>
<fileset dir="D:\Lab\lib\hadoop\hadoop-1.2.1">
<include name="**/*.jar" />
</fileset>
</path>
<target name="compile">
<mkdir dir="${build}" />
<javac includeantruntime="false" srcdir="src" destdir="${build}">
<classpath refid="hadoop-classpath"/>
</javac>
<jar jarfile="pc.jar" basedir="${build}" />
</target>
<target name="clean">
<delete dir="${build}" />
</target>
<target name="print-cp">
<property name="classpath" refid="hadoop-classpath"/>
<echo message="classpath= ${classpath}"/>
</target>
</project>
2、IntelliJ IDEA