我们就简单以Hello,Java World举例说明一下吧!
--------------------------------------------------------------------------------
desc.java //desc.java
//通过继承类来重设desc中的函数达到description this program 的目的
package execute;
public class desc
{
//public String desc="";
public desc()//Constructor
{
}
public void ds(String filename,String desc)//该方法用于为调用该方法的程序输出
{ //一段说明
System.out.println("====================n");
System.out.println("FileName: "+filename+"n");
System.out.println("FileDesc: "+desc+"n");
System.out.println("====================n");
}
}
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
j0001.java package execute;
import execute.*;
//can execute class
//可以执行的类
public class j0001 //extends desc
{
public static void main(String[] args)
{
desc fileds = new desc();
fileds.ds("j0001.java","inherit class");
System.out.println("Hello,Java World!");
}
}
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Manifest.mf(加Class-Path属性) Created-By: macleo
Main-Class: execute.j0001
Class-Path: execute
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
在DOS提示符的方式下输入 d:java>jar cvmf manifest.mf test.jar execute
标明清单(manifest)
增加:execute/(读入= 0) (写出= 0)(存储了 0%)
增加:execute/desc.class(读入= 712) (写出= 411)(压缩了 42%)
增加:execute/j0001.class(读入= 550) (写出= 361)(压缩了 34%)
d:java>
d:java>java -jar test.jar
====================
FileName: j0001.java
FileDesc: inherit class
====================
Hello, Java World!