使用 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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 00:10:57  来源:igfitidea点击:

Build Java entire project jar using JDeveloper

javajarexecutable-jarjdeveloper

提问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..

请按照以下说明操作..

  1. Right-click project and select properties.
  2. Click on Deployment, setup new Deployment by entering Deployment Profile type and name.
  3. Now edit Deployment profile on screen.
  4. Select Jar Options and specify your mainclass.
  1. 右键单击项目并选择属性。
  2. 单击部署,通过输入部署配置文件类型和名称来设置新部署。
  3. 现在在屏幕上编辑部署配置文件。
  4. 选择 Jar Options 并指定您的main类。

If you have 3rd party jar then follow

如果您有第 3 方 jar,请按照以下步骤操作

  1. Select File group the click on New.
  2. Select Dependency Analysis and Ok.
  3. Then select the Contributors under new file group you have created.
    1. Files tab for Files
    2. Libraries tab for Libraries, Include the Libraries you using in your project.
  4. Then Ok.
  1. 选择文件组,然后单击新建。
  2. 选择依赖分析并确定。
  3. 然后在您创建的新文件组下选择贡献者。
    1. 文件的文件选项卡
    2. 库的库选项卡,包括您在项目中使用的库。
  4. 那么好的。

If you don't have 3rd party jar then ignore the above

如果您没有第 3 方 jar,请忽略以上内容

  1. Then right-click on project, select the profile under deploy.
  2. Then Click finish to start deployment.
  1. 然后右键单击项目,选择部署下的配置文件。
  2. 然后点击完成开始部署。

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。