Is there an easy way to export a Java project including all of its external dependencies to a standard .jar file?
I have developed an SDK that uses several Apache libraries and I would like to be able to ship this project as a single jar. The answers I have found thus far to this question require the project to be packaged as a Runnable jar, and does not apply to this project which has no main class.
The rest of the answers I have found assume familiarity with Ant or Maven to accomplish this task, and I have no background with either. There are several scripts out there but I don't understand how I would use/modify them, or what I would to run the script and get a result.
Any answer that can provide more background into how exactly a user with no background with Ant or Maven would do these tasks is greatly appreciated.
For more background information I have trying to combine the following libraries into one called JetstreamSDK.jar
commons-codec-1.6.jar
commons-configuration-1.9.jar
commons-io-2.4.jar
commons-lang-2.6.jar
commons-lang3-3.1.jar
commons-logging-1.1.1.jar
httpclient-4.2.5.jar
httpcore-4.2.4.jar
JetstreamSDK-Java.jar
jibx-bind.jar
jibx-extras.jar
jibx-run.jar
xpp3.jar
jar
file is like zip
compressed file. Usually Eclipse (default) java project will be organized like following directory structure:
some_project
|____ src/ <--- your java source files
|____ bin/ <--- compiled class files
|____ lib/ <--- 3rd party libs e.g. commons*.jar
To package above structure and distribute as a single jar (zip) file- go inside bin/
directory and select everything inside and just right click (assuming you are working on windows) and send to
compressed (zipped) folder. Give a suitable name to the generated zip file eg your-sdk.jar
then right click on lib/
and compress into a another zip together with your-sdk.jar
and you are done. This can be accomplished using jar
command line tool also- but, you have to read the jar options/help on how to do this.
1.) First compile your project
2.) Right click on your PROJECT -> Export -> Java -> Runnable jar
3.) You will get a Dialog box, there select the class name (in which your main method resides)
4.) Give the export destination
5.) In library handling(radio button): select your desired option(all are self descriptive)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.