如何确保 JNLP 应用程序使用最新版本的 JAR?
我有一个桌面应用程序,我想使用 JAVA Web start 启动该应用程序。当我第一次使用浏览器启动它时,它工作正常,它将下载资源中定义的所有 jar。下次我使用 JNLP 或从浏览器运行它时,它不会下载任何 jar。使用的 jars 来自缓存或其他地方,我不知道...
我希望每次启动我的应用程序时下载资源中定义的所有 jars
我的 jnlp 文件包含:
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="" href="">
<information>
<title>example</title>
<vendor>example</vendor>
</information>
<resources>
<!-- Application Resources -->
<j2se version="1.5+"
href="http://java.sun.com/products/autodl/j2se"/>
<jar href="application.jar" main="true" />
<jar href="lib/app.jar" />
</resources>
<application-desc main-class="com.application.entry">
</application-desc>
<update check="background"/>
<security>
<all-permissions/>
</security>
</jnlp>
I have a desktop application and I want to launch that application using JAVA Web start. It is working fine when I am launch it first time using a browser and it will download all jars defined in resources. Next time I run it using JNLP or from browser, it will not download any jars. The jars that are used come from cache or some where else, I don't know...
I want that every time when my application is launched all jars defined in resources are downloaded
my jnlp file contains :
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="" href="">
<information>
<title>example</title>
<vendor>example</vendor>
</information>
<resources>
<!-- Application Resources -->
<j2se version="1.5+"
href="http://java.sun.com/products/autodl/j2se"/>
<jar href="application.jar" main="true" />
<jar href="lib/app.jar" />
</resources>
<application-desc main-class="com.application.entry">
</application-desc>
<update check="background"/>
<security>
<all-permissions/>
</security>
</jnlp>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果有新版本,它将下载 jar。如果没有的话,确实没有必要下载文件。
It will download jars if there are new versions of them. If not, there is really no need to download files.
尽管 Andrew Thompson 指出的行为是您可以预料到的,但您可以像这样更改更新策略:
Although the behavior pointed by Andrew Thompson is something you can expect, you can change the update policy like this:
我们可以设置三种不同的检查配置:
update check="timeout"policy="always"
默认
更新检查=“always”policy=“always
”无论资源发生任何变化,始终下载资源,例如:jar 文件
update check="background "policy="always"
将使已下载到缓存中的当前客户端能够打开,如果资源有任何更改,它将在后台开始下载。下次打开应用程序时,它将以新版本开始。
`
Three different check configs we can be set:
update check="timeout" policy="always"
Default
update check="always" policy="always
"Always download the resources irrespective of any change in resource eg: jar file
update check="background " policy="always"
Will enable the current client already downloaded in cache to open and if there is any change in resources it will start downloading in background.Next time when the application is opened it will start with the new version.
`
是的,这就是解决问题的重点。
解决方案很简单,您已经进行了这些更改:
并且它不能进入任何集合
Yes, it is the point for solving the problem.
The solution is easy, you have make these changes :
And it must not be into anything set