We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
Java Web Start 专门用于此目的。您发送一个 jnlp 文件,然后 java 负责从服务器获取最新版本。
除此之外,您可以下载更新的类并在运行时替换它们。
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.
你说的自我更新是什么意思?
如果您的意思是它在运行时更改其行为(这种情况很少见),您可以创建编写 java 代码、编译它并从正在运行的程序中加载它的代码。我已经看到这样做了。
更常见的场景是核心程序带有插件,插件本身可以在运行时更新。最简单的方法就是使用这些服务的接口,然后在运行时加载这些类型的实例。然而,编写一个完全健壮的插件框架通常是重新发明轮子。有许多现有的架构,例如 OSGi。
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.