close

When we write many program , we also need to manage these program in order to avoid confuse.

Java has provide two method for us to manage these program , Package and Jar.

We will describe these two method follow.

 

Package , for example:

package MyLibrary;

public class PackageDemo

{

//the code body


After finishing our program , we need to type the command as below:

javac -d . PackageDemo.java

 

Jar , for example:

We need to type the command as below to construct a jar file.

jar cvf myLibrary.jar MyLibrary

We also can add new class to existing jar file.

jar uvf myLibrary.jar MyLibrary

Meaning of options:

c : create a new archive.

u : update an existing file named xxx.jar.

v : Generate verbose output to standard output.

f : specifies the name of jar file.

 

ref : http://docs.oracle.com/javase/1.4.2/docs/tooldocs/windows/jar.html

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 JerryCheng 的頭像
    JerryCheng

    KwCheng's blog

    JerryCheng 發表在 痞客邦 留言(0) 人氣()