Reputation: 3241
I would like to build a jar file with eclipse, but the program seems to copy unneccesary files into the jar.
My java gui program project consists of:
<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]
So the progressive question is how to best sort these files.
And the underlying question is how can I generate a jar which mainly only consists of the program.java?
Edit: Thanks for the answers on the underlying question!
Please also address the question above:
What is the common / best way to sort the files of his java gui program?
Upvotes: 2
Views: 179
Reputation: 8395
Download fatjar in eclipse as update site and http://fjep.sourceforge.net/ and use it as mentioned. It is very easy. Or follow the step mentioned by Jakub Zaverka. You can make Runnable Jar or simply a jar as per your requirement
Upvotes: 2
Reputation: 8874
Right click on the project in the Project explorer, select Export, pick Java->Jar file and then you can select which classes and files to include and which do not.
Upvotes: 3