2012-03-12 140 views
1

我想用eclipse構建一個jar文件,但該程序似乎將不需要的文件複製到jar中。構建一個jar文件

我的Java GUI程序的項目包括:

<path>/src/data/program.java [this is the gui] 
<path>/src/data/testcases/testcase.java [here are testcases stored, which are executed by program.java] 
<path>/src/data/system/config.ini [heres some data stored which is collected to set settings inside the program.java] 
<path>/src/bin/.../classes.class [here are the classes stored by eclipse(program.class/testcase.class)] 
<path>/ExtRes/externallibary.jar [here are some external libaries stored] 
<path>/ExtRes/Templates [here are some templates with information stored which program.java collects when used] 
<path>/Img/image.png [image folder for icons inside the program] 
<path>/Logs/.../somelog.txt [here are some logs stored which are output of the program.java] 

所以逐步的問題是如何最好這些文件進行排序。

而潛在的問題是我如何生成一個主要只包含program.java的jar?

編輯:感謝有關基礎問題的答案!

還請解決上述問題:

什麼是他的Java GUI程序的文件進行排序常見/最佳方式是什麼?

+1

有一些JAR Eclipse插件可以配置。例如[FatJar](http://fjep.sourceforge.net/) – 2012-03-12 11:22:48

回答

2

右鍵單擊項目瀏覽器中的項目,選擇導出,選擇Java-> Jar文件,然後選擇要包含哪些類和文件,哪些不包含。

2

下載eclipse中的fatjar作爲更新站點,並使用http://fjep.sourceforge.net/並如上所述使用它。這很容易。 或按照Jakub Zaverka提到的步驟操作。您可以根據您的要求製作Runnable Jar或簡單的一個罐子