How to write a self-updating program in Java? [closed]

大城市里の小女人 提交于 2019-11-28 09:26:12

Java Web Start is meant specifically for this. You ship one jnlp file, and java takes care of fetching the newest version from a server.

Apart from that, you can download updated classes and replace them at runtime.

What do you mean by self-updating ?

If you mean that it changes its behavior at runtime (which is rare), you could create code that writes java code, compiles it, and loads it from within a running program. I've seen that done.

The more common scenario is to have a core program with plug-ins, where the plug-ins themselves can be updated at runtime. The simplest way to do this is simply to use interfaces for these services and then load instantiations of these types at runtime. However, writing a fully robust plug-in framework is usually reinventing the wheel. There are many existing architectures such as OSGi.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!