隨筆 - 154  文章 - 60  trackbacks - 0
          <2007年11月>
          28293031123
          45678910
          11121314151617
          18192021222324
          2526272829301
          2345678

          聲明:

          該blog是為了收集資料,認(rèn)識(shí)朋友,學(xué)習(xí)、提高技術(shù),所以本blog的內(nèi)容除非聲明,否則一律為轉(zhuǎn)載!!

          感謝那些公開自己技術(shù)成果的高人們!!!

          支持開源,尊重他人的勞動(dòng)!!

          常用鏈接

          留言簿(3)

          隨筆分類(148)

          隨筆檔案(143)

          收藏夾(2)

          其他

          學(xué)習(xí)(技術(shù))

          觀察思考(非技術(shù))

          搜索

          •  

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          好久沒玩這個(gè)了!復(fù)習(xí)一下! 
          D盤根目錄下寫  Test.java
           

          public class Test{
              
          public static void main(String[] args){
                  System.out.println(
          "*******--TEST  JAVA!--*********");
              }

          }

          javac Test.java

          試一下 java Test           OK!

          jar cvf  test1.jar Test.class,回車后去D盤,OK多了 test1.jar 
          jar cvf   jar文件名  mf 文件名   .class文件     

          第二種玩法 做一個(gè)*.mf文件內(nèi)容如下:
           
          Manifest-Version: 1.0
          Created-By: 1.6.0-beta2 (Sun Microsystems Inc.)
          Main-Class: Test

          可以根據(jù)第一種方法生成的 MANIFEST.MF  改

          將*.mf 和.class放在一個(gè)目錄中

          jar cvfm h.jar 11.mf  Test.class
          jar cvfm   jar文件名  mf 文件名   .class文件     


          執(zhí)行
          java -jar hello.jar    
          java -jar jar文件全名

          package  com.lk.test打包

          jar cvfm hh.jar test.mf com

          package  com.lk.test打包+配置文件

          jar cvfm hh.jar test.mf com db.properties

          就可以將db.properties放在和com并列的目錄下


          如果使用了第三方j(luò)ar包 : 要寫入.mf文件中

          Manifest-Version: 1.0
          Main-Class: lk.Test
          Class-Path: lib/jxl.jar

          另外在寫manifest.mf 文件的時(shí)候也有兩點(diǎn)務(wù)必注意
          Main-Class: test.test        Class: test.test 之間的一個(gè)空格,另外,行尾務(wù)必回車換行


          ===========jar幫助================

          用法: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...
          選項(xiàng)包括:
              -c  創(chuàng)建新的歸檔文件
              -t  列出歸檔目錄
              -x  解壓縮已歸檔的指定(或所有)文件
              -u  更新現(xiàn)有的歸檔文件
              -v  在標(biāo)準(zhǔn)輸出中生成詳細(xì)輸出
              -f  指定歸檔文件名
              -m  包含指定清單文件中的清單信息
              -e  為捆綁到可執(zhí)行 jar 文件的獨(dú)立應(yīng)用程序指定應(yīng)用程序入口點(diǎn)

              -0  僅存儲(chǔ);不使用任何 ZIP 壓縮
              -M  不創(chuàng)建條目的清單文件
              -i  為指定的 jar 文件生成索引信息
              -C  更改為指定的目錄并包含其中的文件

          如果有任何目錄文件,則對(duì)其進(jìn)行遞歸處理。
          清單文件名、歸檔文件名和入口點(diǎn)名的指定順序與 "m"、"f" 和 "e" 標(biāo)志的指定順序相同。

          示例 1:將兩個(gè)類文件歸檔到一個(gè)名為 classes.jar 的歸檔文件中:
                 jar cvf classes.jar Foo.class Bar.class
          示例 2:使用現(xiàn)有的清單文件 "mymanifest" 并
                     將 foo/ 目錄中的所有文件歸檔到 "classes.jar" 中:
                 jar cvfm classes.jar mymanifest -C foo/ .


          補(bǔ)充:
          ############

          jar基本操作:

          ############

          1. 創(chuàng)建jar文件
          jar cf jar-file input-file(s)
          c---want to Create a JAR file.
          f---want the output to go to a file rather than to stdout.
          eg: 1)jar cf myjar.jar query_maintain_insert.htm
          2)jar cvf myjar.jar query_maintain_insert.htm
          v---Produces verbose(詳細(xì)的) output.
          3)jar cvf myjar.jar query_maintain_insert.htm mydirectory
          4)jar cv0f myjar.jar query_maintain_insert.htm mydirectory
          0---don't want the JAR file to be compressed.
          5)jar cmf MANIFEST.MF myjar.jar yahh.txt
          m---Used to include manifest information from an existing manifest file.
          6)jar cMf MANIFEST.MF myjar.jar yahh.txt
          M---the default manifest file should not be produced.
          7)jar cvf myjar.jar *
          *---create all contents in current directory.
          2. 察看jar文件
          jar tf jar-file
          t---want to view the Table of contents of the JAR file.
          eg: 1)jar vft yahh.jar
          v---Produces verbose(詳細(xì)的) output.
          3. 提取jar文件
          jar xf jar-file [archived-file(s)]
          x---want to extract files from the JAR archive.
          eg: 1)jar xf yahh.jar yahh.txt(僅提取文件yahh.txt)
          2)jar xf yahh.jar alex/yahhalex.txt(僅提取目錄alex下的文件yahhalex.txt)
          3)jar xf yahh.jar(提取該jar包中的所有文件或目錄)
          4. 修改Manifest文件
          jar cmf manifest-addition jar-file input-file(s)
          m---Used to include manifest information from an existing manifest file.

          5. 更新jar文件

          jar uf jar-file input-file(s)
          u---want to update an existing JAR file.
          posted on 2007-11-06 15:22 lk 閱讀(371) 評(píng)論(0)  編輯  收藏 所屬分類: j2se
          主站蜘蛛池模板: 新化县| 苏尼特右旗| 墨竹工卡县| 多伦县| 岫岩| 页游| 达州市| 克什克腾旗| 汾阳市| 渑池县| 张家界市| 尉犁县| 图片| 云和县| 新兴县| 东莞市| 永丰县| 石泉县| 辰溪县| 阳西县| 青阳县| 融水| 松潘县| 阿城市| 措勤县| 北海市| 通化县| 剑阁县| 汤原县| 丰都县| 安达市| 永州市| 文化| 漳浦县| 囊谦县| 衢州市| 旌德县| 营山县| 汕尾市| 从化市| 广平县|