简体   繁体   English

在 Java Web 中的 jar 中加载 jar 时出现奇怪的行为 Start

[英]weird behavior when loading jar inside a jar in Java Web Start

Hell All, So I have been facing this behavior for quite some time and I am sure some else has also faced it and know the solution.地狱所有,所以我已经面对这种行为很长一段时间了,我相信其他人也遇到过它并且知道解决方案。 I am exporting my application jar as a runnable jar using eclipse and obviously this application have many other jar and so I am exporting with option packed other jar inside the main jar. The problem is when I am starting my application it is not loading the file from db2jcc.jar and few other jar but If I deploy db2jcc.jar as separate jar application running fine.我正在使用 eclipse 将我的应用程序 jar 导出为可运行的 jar,显然该应用程序还有许多其他 jar,因此我在主 jar 中使用选项打包其他 jar 进行导出,当我没有启动我的应用程序时,它的问题是来自 db2jcc.jar 和其他一些 jar 但如果我将 db2jcc.jar 部署为单独的 jar 应用程序运行良好。 在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

All I want to keep my jnlp file and signing of jar process as simple as possible, that is why I am including jar in main jar. Thanks very much for your suggestion.我只想让我的 jnlp 文件和 jar 过程的签名尽可能简单,这就是为什么我在主要 jar 中包含 jar 的原因。非常感谢您的建议。 I am using Rational Software Architect 8.0( based on eclipse ) for export我正在使用 Rational Software Architect 8.0(基于 eclipse)进行导出

I don't think it's a good idea to include the dependencies (other jar files) inside your main jar file.我认为将依赖项(其他 jar 文件)包含在主 jar 文件中不是一个好主意。 Maybe there is a way to make that work, but there is a good reason not to do that: caching .也许有一种方法可以做到这一点,但有一个很好的理由不这样做:缓存

Java Web Start caches jar files on the client computer. Java Web 开始在客户端计算机上缓存 jar 个文件。 So by keeping them separate from your application jar, Java Web Start doesn't have to download them all over again each time you update your application.因此,通过将它们与您的应用程序 jar、Java Web 分开,Start 不必在每次更新应用程序时重新下载它们。 Your screenshot shows that you have more than 12MB of dependencies, so that's a lot to make people download every time.您的屏幕截图显示您有超过 12MB 的依赖项,所以每次都让人下载很多。

If you're worried about making the signing process a simple as possible, then just write a script to do it for you.如果您担心让签名过程尽可能简单,那么只需编写一个脚本来为您完成。 In fact, I notice in the screenshot that the wizard will create an Ant script for you.事实上,我在屏幕截图中注意到向导将为您创建一个 Ant 脚本。 I suggest that you get it to create the Ant script for you, then just run that script instead — it should be simpler and faster than stepping through a wizard each time!我建议您使用它来为您创建 Ant 脚本,然后只需运行该脚本 — 它应该比每次都通过向导更简单、更快速!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM