使用Eclipse将具有外部依赖性的Java项目导出到jar [英] Exporting a Java project with external dependencies to a jar using Eclipse
问题描述
是否有一种简单的方法可以将Java项目(包括其所有外部依赖项)导出到标准的.jar文件中?
Is there an easy way to export a Java project including all of its external dependencies to a standard .jar file?
我开发了一个使用多个Apache库的SDK,我希望能够将这个项目作为一个jar运送。到目前为止我在这个问题上找到的答案要求将项目打包为Runnable jar,并且不适用于没有主类的这个项目。
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.
我发现的其余答案都假设熟悉Ant或Maven来完成这项任务,而且我也没有背景。有几个脚本,但我不明白我将如何使用/修改它们,或者我将运行脚本并获得结果。
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.
非常感谢任何可以提供更多背景信息的答案,这些答案指的是没有Ant或Maven背景的用户如何完成这些任务。
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.
有关更多背景信息,我尝试将以下库组合成一个名为JetstreamSDK.jar的库
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
推荐答案
1。)首先编译你的项目
1.) First compile your project
2。)右键单击你的PROJECT - > Export - > Java - > Runnable jar
2.) Right click on your PROJECT -> Export -> Java -> Runnable jar
3。)你会得到一个对话框,在那里选择类名(你的主要名称)方法驻留)
3.) You will get a Dialog box, there select the class name (in which your main method resides)
4。)给出口目的地
5.。)在库处理(单选按钮) :选择您想要的选项(都是自描述的)
5.) In library handling(radio button): select your desired option(all are self descriptive)
这篇关于使用Eclipse将具有外部依赖性的Java项目导出到jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!