使用 JDeveloper 构建 Java 整个项目 jar
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10240703/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Build Java entire project jar using JDeveloper
提问by Shantanu Banerjee
I am using JDeveloper 11g to develop a desktop application. I want to make entire project jar which is run-able in java environment.. if I use only standard Java library jar works fine but my project contains external library like JfreeChart, Comm, Hibernate3 etc etc... when I try to make jar Its shows errors how can I make entire jar of my projects along with external library's.
我正在使用 JDeveloper 11g 开发桌面应用程序。我想制作可以在 java 环境中运行的整个项目 jar .. 如果我只使用标准的 Java 库 jar 工作正常但我的项目包含外部库,如 JfreeChart、Comm、Hibernate3 等......当我尝试制作 jar 时它显示了错误,我如何制作我的项目的整个 jar 以及外部库的。
thank you
谢谢
回答by Shantanu Banerjee
Please follow the below instructions..
请按照以下说明操作..
- Right-click project and select properties.
- Click on Deployment, setup new Deployment by entering Deployment Profile type and name.
- Now edit Deployment profile on screen.
- Select Jar Options and specify your
main
class.
- 右键单击项目并选择属性。
- 单击部署,通过输入部署配置文件类型和名称来设置新部署。
- 现在在屏幕上编辑部署配置文件。
- 选择 Jar Options 并指定您的
main
类。
If you have 3rd party jar then follow
如果您有第 3 方 jar,请按照以下步骤操作
- Select File group the click on New.
- Select Dependency Analysis and Ok.
- Then select the Contributors under new file group you have created.
- Files tab for Files
- Libraries tab for Libraries, Include the Libraries you using in your project.
- Then Ok.
- 选择文件组,然后单击新建。
- 选择依赖分析并确定。
- 然后在您创建的新文件组下选择贡献者。
- 文件的文件选项卡
- 库的库选项卡,包括您在项目中使用的库。
- 那么好的。
If you don't have 3rd party jar then ignore the above
如果您没有第 3 方 jar,请忽略以上内容
- Then right-click on project, select the profile under deploy.
- Then Click finish to start deployment.
- 然后右键单击项目,选择部署下的配置文件。
- 然后点击完成开始部署。
After finish deployment you see the jar in your project/deployment folder.
完成部署后,您会在项目/部署文件夹中看到 jar。
回答by Coffee
Yes, you can do so. Have a look here - Java create standalone jar with external jarsand also here - Put external library to the JAR?
是的,你可以这样做。看看这里 - Java 创建带有外部 jar 的独立 jar以及这里 -将外部库放入 JAR?
The simple way is to use a tool, but you can use ant too, to recompile a set of JAR's into one big-fat JAR.
简单的方法是使用工具,但您也可以使用 ant,将一组 JAR 重新编译为一个大的 JAR。