Java Web Start 的替代品?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5884790/
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-30 13:16:45  来源:igfitidea点击:

Alternatives to Java Web Start?

javaauto-updatejava-web-start

提问by Konrad Garus

We're having huge issues with Java Web Start in production. We're afraid to release because every time we do, help desk gets calls from 1/3 users getting an "unable to launch"error. It's hard to tell whether it's because of user error, cancellation in the middle of download, poor network connection or anything. But the bottom line is:

我们在生产中遇到了 Java Web Start 的巨大问题。我们害怕发布,因为每次我们发布时,服务台都会接到 1/3 用户的电话,并收到“无法启动”错误。很难判断是因为用户错误、下载中途取消、网络连接不良还是其他原因。但底线是:

We find it terribly unreliable.

我们发现它非常不可靠。

What are the alternatives for deploying and updating a rich Swing application? Either free or commercial, I'm more interested in features and robustness.

部署和更新富 Swing 应用程序的替代方法有哪些?无论是免费的还是商业的,我对功能和健壮性更感兴趣。

Reliability is key, but I would also like to have the following:

可靠性是关键,但我还想拥有以下几点:

  • Install once, update automatically from a simple HTTP hosting like JWS
  • Differential updates
  • Support for multiple configurations (think of 30 instances which may have different versions of the application or different launch parameters - would be nice not to build 30 artifacts each time)
  • Win / Mac / Linux support. Hopefully one that does not mean I have to maintain 3 builds for each instance.
  • 安装一次,从简单的 HTTP 托管(如 JWS)自动更新
  • 差异化更新
  • 支持多种配置(想想 30 个实例,它们可能具有不同版本的应用程序或不同的启动参数 - 最好不要每次构建 30 个工件)
  • Win / Mac / Linux 支持。希望这并不意味着我必须为每个实例维护 3 个构建。

采纳答案by PhilDin

I feel your pain, the biggest issue I've had with JWS is visibility, that is, what is it doing and why is it doing it. Most of our issues were related to internal proxies (Java seems to really not like authenticating proxies) and the wrinkles seemto be ironed out for the moment. Nevertheless, I did consider simply writing a replacement. This is not as crazy as it sounds, JWS does an awful lot of stuff that I don't really care about, namely, integrating with the web browser and checking JVM versions. Consider the following scenario:

我感到您的痛苦,我在 JWS 中遇到的最大问题是可见性,即它在做什么以及为什么要这样做。我们的大部分问题都与内部代理有关(Java 似乎真的不喜欢对代理进行身份验证),目前这些问题似乎已经解决。尽管如此,我确实考虑过简单地写一个替代品。这并不像听起来那么疯狂,JWS 做了很多我并不真正关心的事情,即与 Web 浏览器集成和检查 JVM 版本。考虑以下场景:

  1. You launch a Java application (the launch app). This application takes a single parameter which is a URL of a JNLP file.
  2. The launch app hashes the URL and uses this as the basis for a local folder (repository) in which to store any downloaded jars for the app. If the repository doesn't exist, it will create it.
  3. The launch app attempts to download the JNLP pointed to by the URL. If it can't download it, it will just launch whatever is in the repository (maybe warning the user)
  4. If it can download the JNLP, parse it and list any jars that need downloading. If you already have the jars, use something like Apache HttpClient in order to determine whether the server has a newer version and download if required. The important point is that any downloads should be stored in a temporary folder. Once ALLof the downloads have succeeded, you can apply these to the local repository. Ideally, you will back up what is already there in order to allow some sort of rollback procedure.
  1. 您启动 Java 应用程序(启动应用程序)。此应用程序采用单个参数,即 JNLP 文件的 URL。
  2. 启动应用程序对 URL 进行哈希处理,并将其用作本地文件夹(存储库)的基础,在该文件夹中存储应用程序的任何下载的 jar。如果存储库不存在,它将创建它。
  3. 启动应用程序尝试下载 URL 指向的 JNLP。如果它无法下载它,它只会启动存储库中的任何内容(可能会警告用户)
  4. 如果它可以下载 JNLP,则解析它并列出所有需要下载的 jar。如果您已经有了这些 jar,请使用 Apache HttpClient 之类的东西来确定服务器是否有更新的版本,并在需要时下载。重要的一点是,任何下载都应存储在临时文件夹中。一旦所有下载成功,您就可以将这些应用到本地存储库。理想情况下,您将备份已经存在的内容,以便进行某种回滚过程。

This should provide some very significant advantages over regular JNLP:

与常规 JNLP 相比,这应该提供一些非常显着的优势:

  1. Visibility, you can log exactly what is happening
  2. Much better failure modes: if the download gets interrupted just launch the version that's already there (obviously, this won't work if the interrption occurs on the first download), if you feel like telling the user about it then do so.
  3. By running as a local app you should avoid running into issues with signing of jars, I honestly don't understand the Java Web Start security model with respect to signed jars but it seems that if different classloaders are involved, JWS will complain about it (I think)
  1. 可见性,您可以准确记录正在发生的事情
  2. 更好的故障模式:如果下载被中断,只需启动已经存在的版本(显然,如果中断发生在第一次下载时,这将不起作用),如果您想告诉用户它然后这样做。
  3. 通过作为本地应用程序运行,您应该避免遇到 jar 签名问题,老实说,我不了解有关签名 jar 的 Java Web Start 安全模型,但似乎如果涉及不同的类加载器,JWS 会抱怨它(我认为)

Sadly, I'm not in a position to fire you over a working version of the above, I did start a prototype but suspended it. I may have to return to it in future in which case, I'll be happy to share the finished version.

可悲的是,我不能因为上述的工作版本而解雇你,我确实开始了一个原型但暂停了它。在这种情况下,我将来可能不得不返回它,我很乐意分享完成的版本。

Cheers, Phil

干杯,菲尔

回答by Heidarzadeh

Currently we are using GetDownto handle distribution of our swing applications. We use Tomcat to distribute updates and GetDownto download those updates. It's really flexible and powerful, and much better than java WebStart and because it produces check sum for changes it saves bandwith and downloads just changed files.

目前我们正在使用GetDown来处理我们的 Swing 应用程序的分发。我们使用 Tomcat 分发更新并使用GetDown下载这些更新。它非常灵活和强大,比 java WebStart 好得多,因为它为更改生成校验和,因此可以节省带宽并下载刚刚更改的文件。

A good tutorial : http://www.hascode.com/2012/05/creating-updatable-java-applications-using-getdown-and-the-getdown-maven-plugin/

一个很好的教程:http: //www.hascode.com/2012/05/creating-updatable-java-applications-using-getdown-and-the-getdown-maven-plugin/

回答by Stephen M -on strike-

With Java Web Start being deprecated by Oracle, we are considering using Microsoft's .NET Click Once to download and launch our Java application.

由于 Oracle 不推荐使用 Java Web Start,我们正在考虑使用 Microsoft 的 .NET Click Once 来下载并启动我们的 Java 应用程序。

We will have a Click Once .application file run a little MS program that detects Java, downloads our latest jar files and then launches our Java program using the detected version of Java and the Jar files.

我们将有一个 Click Once .application 文件运行一个小的 MS 程序来检测 Java,下载我们最新的 jar 文件,然后使用检测到的 Java 版本和 Jar 文件启动我们的 Java 程序。

Of course, this is only a solution for Windows machines, but we are customers are exclusively on Windows, so this works in that environment.

当然,这只是适用于 Windows 机器的解决方案,但我们是专门使用 Windows 的客户,因此这适用于该环境。

MS's Click Once: https://docs.microsoft.com/en-us/visualstudio/deployment/clickonce-security-and-deployment

MS 点击一次:https: //docs.microsoft.com/en-us/visualstudio/deployment/clickonce-security-and-deployment

回答by Peter Knego

You could use an installer: for example Install4j.

您可以使用安装程序:例如Install4j

You can find a list of installers here: What are good InstallAnywhere replacements for installing a Java EE application?

您可以在此处找到安装程序列表:安装 Java EE 应用程序有哪些好的 InstallAnywhere 替代品?

回答by herberlin

You could also give Zero Install a try. It's cross platform (Linux, Win, Mac), offers jrd download and auto update and has a nice system integration.

您也可以尝试零安装。它是跨平台的(Linux、Win、Mac),提供 jrd 下载和自动更新,并具有很好的系统集成。

Drawback in my eyes that its not easy to handle..

我眼中的缺点是不容易处理..

http://0install.net/

http://0install.net/