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

你说的曾经没有我的故事 提交于 2019-11-27 02:54:34

问题


How can i make a Java program which can update itself. I make this program for use within small team. I do not need any advanced features. I just need a simple and minimal solution.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/4706153/how-to-write-a-self-updating-program-in-java

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