使用自己的Java软件的自定义更新实现
我有一个工作正常的服务器和客户端,它们相互传输文件并成功处理命令。问题是,一旦连接到服务器,服务器就可以要求客户端更新自身。
由于我使用带有 TCP 连接的套接字完成了所有操作,并且无法使用 java web start,因此我正在寻找一种可以更新软件的方法。
我想到的一件事是:
- 让java调用另一个java软件并自行关闭。然后其他java软件将再次连接到服务器并等待更新请求,因此它可以替换当前版本中的所有文件(lib目录和jar主文件 - 我使用Netbeans)。
也许我可以将连接对象发送到将更新的软件,但主要仅接受字符串。
所以我在这里问两个问题:
- 这是一个好的解决方案吗?或者还有更好的吗?
- 如果我这样做,如何将我的原型的客户端对象从一个应用程序发送到另一个应用程序?
I have a server, and Client that are working fine, they transfer file to each other and handle commands with success. The thing is that once connected to the server, the server can ask the Client to update itself.
Since I did everything using sockets with a TCP connection, and I am NOT able to use java web start, I am looking for a way I can update the software.
One thing I thought was:
- Making the java call another java software and close itself. Then the other java software, would connect to the server again and waits for the update request, so it could replace all files from the current version (lib directory and the jar main file - Im using Netbeans).
Maybe I could just send the connection Object to the Software that would update, but the main only accpets String.
So I ask two questions here:
- Is this a good solution? Or is there a better one?
- If I do that, how can I send the Client Object of my proto from one application to another?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议在具有最新版本应用程序的服务器上保留一个属性文件。
每次启动应用程序时,都会比较版本是否可更新,然后在临时目录中下载所有新更新。
下载成功后,调用另一个小应用程序将这些文件复制到您的 lib 文件中,以便实际更新您的应用程序。
最后提示用户该应用程序已已更新并启动新更新的应用程序。我想说。
I would suggest keep a property file on server having latest version of app.
Each time you start the app compare version if its updatable then download all new updates in a temp dir
After SUCCESSFUL download invoke another small application to copy those files to your lib file in order to update your app actually
At the end prompt user that app has been updated and launch the newly updated app. i would say.