如何确保 JNLP 应用程序使用最新版本的 JAR?

发布于 2024-12-19 10:42:03 字数 1006 浏览 3 评论 0原文

我有一个桌面应用程序,我想使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

顾忌 2024-12-26 10:42:03

如果有新版本,它将下载 jar。如果没有的话,确实没有必要下载文件。

It will download jars if there are new versions of them. If not, there is really no need to download files.

幸福不弃 2024-12-26 10:42:03

尽管 Andrew Thompson 指出的行为是您可以预料到的,但您可以像这样更改更新策略:

<?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="always" policy="always"/>
   <security>
     <all-permissions/>
   </security>
</jnlp>

Although the behavior pointed by Andrew Thompson is something you can expect, you can change the update policy like this:

<?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="always" policy="always"/>
   <security>
     <all-permissions/>
   </security>
</jnlp>
笔落惊风雨 2024-12-26 10:42:03

我们可以设置三种不同的检查配置:

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

`

扛起拖把扫天下 2024-12-26 10:42:03

是的,这就是解决问题的重点。

解决方案很简单,您已经进行了这些更改:

update check="always" policy="always

并且它不能进入​​任何集合

Yes, it is the point for solving the problem.

The solution is easy, you have make these changes :

update check="always" policy="always

And it must not be into anything set

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文