在 Java Web Start 中将 jar 加载到 jar 中时出现奇怪的行为 [英] weird behavior when loading jar inside a jar in Java Web Start

查看:22
本文介绍了在 Java Web Start 中将 jar 加载到 jar 中时出现奇怪的行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

见鬼去吧,所以我已经面对这种行为很长一段时间了,我相信其他一些人也遇到过这种情况并知道解决方案.我正在使用 eclipse 将我的应用程序 jar 作为可运行的 jar 导出,显然这个应用程序有许多其他 jar,所以我在主 jar 中使用选项打包其他 jar 导出.问题是当我启动我的应用程序时,它没有从 db2jcc.jar 和其他几个 jar 加载文件,但是如果我将 db2jcc.jar 部署为单独的 jar 应用程序运行良好.

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.

我只想保持我的 jnlp 文件和 jar 进程的签名尽可能简单,这就是我在主 jar 中包含 jar 的原因.非常感谢您的建议.我正在使用 Rational Software Architect 8.0(基于 eclipse)进行导出

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. I am using Rational Software Architect 8.0( based on eclipse ) for export

推荐答案

我认为在主 jar 文件中包含依赖项(其他 jar 文件)不是一个好主意.也许有一种方法可以使之奏效,但有一个很好的理由不这样做:缓存.

I don't think it's a good idea to include the dependencies (other jar files) inside your main jar file. Maybe there is a way to make that work, but there is a good reason not to do that: caching.

Java Web Start 在客户端计算机上缓存 jar 文件.因此,通过将它们与应用程序 jar 分开,Java Web Start 不必在每次更新应用程序时重新下载它们.您的屏幕截图显示您有超过 12MB 的依赖项,因此每次都需要大量下载.

Java Web Start caches jar files on the client computer. 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. Your screenshot shows that you have more than 12MB of dependencies, so that's a lot to make people download every time.

如果您担心让签名过程尽可能简单,那么只需编写一个脚本来为您完成.事实上,我在屏幕截图中注意到向导将为您创建一个 Ant 脚本.我建议您使用它为您创建 Ant 脚本,然后改为运行该脚本 - 它应该比每次单步执行向导更简单、更快!

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. 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!

这篇关于在 Java Web Start 中将 jar 加载到 jar 中时出现奇怪的行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆