Eclipse將引用了第三方jar包的Java項目打包成jar檔案

來源:互聯網
上載者:User

標籤:

參見: http://www.cnblogs.com/lanxuezaipiao/p/3291641.html

Fat Jar Eclipse Plug-In是一個可以將Eclipse Java Project的所有資源打包進一個可執行jar檔案的小工具,可以方便的完成各種打包任務,我們經常會來打jar包,但是eclipse內建的打包jar似乎不太夠用,Fat Jar是eclipse的一個外掛程式,特別是Fat Jar可以打成可執行Jar包,並且在圖片等其他資源、引用外包方面使用起來更方便。


安裝方法:

1. Eclipse線上更新方法
Help > Install New Software > Add,
name:Fat Jar
location:http://kurucz-grafika.de/fatjar

2. Eclipse外掛程式手動安裝方法
:http://downloads.sourceforge.net/fjep/net.sf.fjep.fatjar_0.0.27.zip?modtime=1195824818&big_mirror=0
將解壓出的plugins中的檔案複製到eclipse安裝目錄中的plugins目錄下,然後重啟eclipse即可。

使用方法:

步驟1:右擊工程項目選擇Buile Fat Jar

 

步驟2:配置jar檔案存放目錄,主Main檔案等,如

 

步驟3:選擇所要用到的第三方jar包

 

最後Finish,即產生了我們要的jar檔案,十分方便。

打包完後命令列執行,如果jar包未指定運行檔案,如下方式運行:

其中org.openadaptor.util.MD5Util為運行類名, F:\\ftp1\\test444.pdf和F:\\ftp1\\test444.pdf.md5分別問main函數的兩個參數

java -classpath .;F:\install\openadaptor-3.4.7\lib\openadaptor.jar org.openadaptor.util.MD5Util F:\\ftp1\\test444.pdf   F:\\ftp1\\test444.pdf.md5

如果jar包指定運行檔案,按如下方式運行:

其中http://192.168.100.169:9000/ws/jaxws/fileTransferService1、F:/ftp/test.txt、D:/share/portal_ESB/ftp/test.txt分別為main函數啟動並執行3個參數

java -jar cxfWebservice_fat.jar http://192.168.100.169:9000/ws/jaxws/fileTransferService1 F:/ftp/test.txt D:/share/portal_ESB/ftp/test.txt

Eclipse將引用了第三方jar包的Java項目打包成jar檔案

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.