如何使Java应用程序自动更新? [英] How do I make a Java app self-update?

查看:291
本文介绍了如何使Java应用程序自动更新?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题:我有一个在内部公司服务器上作为服务运行的独立Java应用程序(以下称为代理)。它作为一些中央服务器的远程代理。随着代理商在更多地方部署,管理越来越复杂。具体来说:推送更新是痛苦的,因为它是一个非常手动的过程,并且访问有关代理运行的环境的日志和其他信息是有问题的,从而使调试变得困难。正在讨论的服务器是无人值守的,无人值守的,这意味着这必须是一个完全自动化的过程,无需人工干预,因此, Web Start不是一个可行的解决方案。

Problem: I have a standalone Java app (henceforth known as "the agent") that runs as a service on internal company servers. It acts as a remote agent for some central servers. As the agent gets deployed in more places, managing them is getting more complicated. Specifically: pushing updates is painful because it's a fairly manual process, and getting access to the logs and other info about the environments where the agents are running is problematic, making debugging difficult. The servers under discussion are headless and unattended, meaning that this has to be a fully automated process with no manual intervention, hence Java Web Start isn't a viable solution.

建议的解决方案:定期将代理电话回到中央服务器(提供代理身份)并检查更新。

Proposed solution: Make the agent phone home (to the central servers) periodically to provide agent status and check for updates.

我对其他建议的问题解决方案开放,但是我已经获得了一个状态和自我更新的原型,这是这个问题的重点。

I'm open to other suggested solutions to the problem, but I've already got a working prototype for the "status and self-updates" idea, which is what this question is focused on.

我想到的实际上是一个单独的项目,作为代理的包装器。包装器周期性地通过HTTP调用中央服务器来检查代理的更新版本。找到更新后,它下载新版本,关闭运行代理,并启动新版本。如果这似乎是一个奇怪或迂回的解决方案,这里还有一些值得注意的其他注意事项/限制:

What I came up with is actually a separate project that acts as a wrapper for the agent. The wrapper periodically calls the central server via HTTP to check for an updated version of the agent. Upon finding an update, it downloads the new version, shuts down the running agent, and starts the new one. If that seems like an odd or roundabout solution, here are a few other considerations/constraints worth noting:


  1. 当包装器获得新版本的代理,可能有新的JAR依赖关系,意味着类路径更改,这意味着我可能想要生成一个单独的Java进程,而不是与ClassLoaders混淆,并运行永久性内存泄漏的风险,这将需要手动干预我想要逃避什么这就是为什么我最终使用一个单独的包装过程来管理我的原型中的代理更新。

  2. 部署代理的某些服务器资源有限,因此任何解决方案需求CPU和内存使用量不足。这使我想要一个不涉及旋转一个新的JVM的解决方案,并且是一个单独的包装程序的冲击。

  3. 代理已经部署到Windows和RHEL服务器上,所以解决方案必须是跨平台的,尽管我不会在批处理和bash脚本中复制合理数量的进程以使事情滚动。

问题:正如我所说,我想知道如何使自动更新Java应用程序。更具体地说,有什么框架/库可以帮助我吗?有没有经验的人可以给我一些指针?

Question: As stated, I want to know how to make a self-updating Java app. More specifically, are there any frameworks/libraries out there that would help me with this? Can someone with experience in this area give me some pointers?

推荐答案

不同的解决方案:使用(并支付)install4j。查看自动更新功能此处

Different solution: use (and pay for) install4j. Check out the auto-update features here

这篇关于如何使Java应用程序自动更新?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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