ANT打包
package src;
public class Hello {
/**
* @param args
*/
public static void main(String[] args) {
// TODO 自动生成方法存根
System.out.println("good");
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<project name="Hello" default="run" basedir="." ><!-- 默认执行run --!>
<property name="src" value="src"/> <!--这里定义了src=src dest=classes --!>
<property name="dest" value="classes"/>
<property name="hello_jar" value="hello.jar" />
<target name="init">
<mkdir dir="${dest}"/>
</target>
<target name="compile" depends="init">
<javac srcdir="${src}" destdir="${dest}"/>
</target>
<target name="build" depends="compile">
<jar jarfile="${hello_jar}" basedir="${dest}"/>
</target>
<target name="run" depends="build">
<java classname="src.Hello" classpath="${hello_jar}"/>
</target>
</project>