Swing应用程序添加自更新功能的最佳方法是什么

Swing应用程序添加自更新功能的最佳方法是什么

本文介绍了为Java Swing应用程序添加自更新功能的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试找到一种方法来为我正在处理的Java / Swing应用程序添加自我更新功能。

I'm trying to figure out a way to add a self-update feature to a Java/Swing application I'm working on.

基本上我是获得了一堆具有额外功能的jar文件,以便在安装的用户更改时重新部署。没有什么复杂的,只需检查是否已发布新版本,通过HTTP下载它们,然后可选择重新启动应用程序给用户。

Basically I've got a bunch of jar files with extra functionality to be re-deployed to the installed users when they change. Nothing complicated, just check if a new version has been released, download them over HTTP, and then optionally offer to restart the app to the user.

我看了一下webstart,它可以工作。但这个特殊的应用程序做了一些时髦的东西,类加载和GC内存设置看起来不像是通过webstart支持,或至少会使问题复杂化。 (这是JMeter的调整版本)

I had a look at webstart, and it could work. But this particular app does some funky stuff with classloading and GC memory settings that don't look like they are supported via webstart, or will at least complicate matters. (It's a tweaked build of JMeter)

我还加入了这个插件处理程序,但它是非常alpha的,并试图用你通常使用alpha填充的bug做太多。

I also went down the road of adding in this plugin handler http://swing-fx.blogspot.com/2008/06/add-auto-update-and-plugins-to-your.html, but it is very alpha, and tries to do too much with the usual bugs you get with alpha stuff.

推荐答案

我做了完全相同的事情。但这很久以前所以今天可能有更好的工具。

I did the exact same thing. But that was long back so there are probably better tools today.

我发现我需要的是装载机。加载器主程序在类路径中没有app jar。它首先根据需要下载了更新,然后在类路径中使用app jars创建了一个自定义类加载器,并调用了应用程序主类的main方法。这不是很复杂。 IIRC我需要这样做,因为如果它们已经在类路径中,则不能在窗口中覆盖罐子。

What I found out I needed was a loader. The loader main program did not have the app jars in classpath. It first downloaded an update if required and then created a custom classloader with the app jars in class path and invoked the main method of the application main class. It is not very complicated. IIRC I needed to do this because the jars could not be overwritten in windows if they were already in classpath.

希望这会有所帮助。

这篇关于为Java Swing应用程序添加自更新功能的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 09:49