开发者

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

开发者 https://www.devze.com 2023-02-04 07:06 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 4 years ago.

Improve this question

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.开发者_如何学Python I just need a simple and minimal solution.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号