How to automatically upgrade Java programs online

Source: Internet
Author: User

Sometimes ourProgramYou need to connect to the server to detect the new version. If you find the new version, you need to automatically download and upgrade it. But in windows, how can I replace a running program file?
Of course there is a way, the steps are as follows:

1. Package and release our program using Java program proxy (here we need to use its advanced version instead of the free version, click to download)
2. The program runs normally. Connect to the server and check the new version.
3. When a new version is found, download the new version file from the server (generally a jar package) to the folder where the program is located, and add ". Update" as the file extension.
4. prompt the user to restart

This completes the online upgrade process.

The above steps may be abstract. Here is an example:
Suppose our program is packaged into "program. jar ", the new version is found on the server during running, so we need to download the new version of" program. jar, and name it "program. jar. update, and then prompt the user to restart the program.
What if the third-party jar package dependent on our program lock needs to be upgraded? Similarly, download the new jar version to the same directory as the old jar version and name it "XXX. Update.

Of course, the program may fail to be upgraded, or the version may need to be rolled back for other reasons. How can this problem be solved?

During the upgrade of Java program proxy, the old program file has been renamed as "XXX. Bak ". What to do next is obvious: Rename "XXX. Bak" to "XXX. Update" and prompt the user to restart the program.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.