Oops! Ant quick start 1 ! - sheer java

Oops! Ant quick start 1 ! - sheer java
reference:
http://ant.apache.org/manual/


1. 新建c:\javademo目录
2. 在javademo目录下,新建src\oata\文件夹
3.在oata目录下新建文件
package  oata;

public   class  HelloWorld {
    
public   static   void  main(String[] args) {
        System.out.println(
" Hello World " );
    }
}


4.在javademo目录下:
md build\classes
javac -sourcepath src -d build\classes src\oata\HelloWorld.java
java -cp build\classes oata.HelloWorld

可以看到结果:
Hello World
5.在javademo目录下:
echo Main-Class: oata.HelloWorld>myManifest
md build\jar
jar cfm build\jar\HelloWorld.jar myManifest -C build\classes .
java -jar build\jar\HelloWorld.jar


也可以看到结果:
Hello World

你可能感兴趣的:(Oops! Ant quick start 1 ! - sheer java)