RockLei--------给Swing项目添加一个更新程序
更新程序以前没做过,直接开干
思路就是下载文件,替换文件,简单直接
项目是用Swing做的,用exe4j打包成exe文件给用户
Java的资源包放在根目录lib文件夹中,更新的话只需要替换里面的jar就行了
直接上代码
/**
* @Auther: Eiden J.P Zhou
* @Date: 2018/4/8
* @Description:
* @Modified By:
*/
public class MainWindow {
public static void main(String[] args) {
Properties properties = new Properties();
String localVersion;
String serverVision;
String ServerURL;
String jarName;
char i = 'a';
JarURLConnection jarConnection = null;
String configFile = "./config/config.properties";
try {
properties.load(
new InputStreamReader(new FileInputStream(new File(configFile).getAbsolutePath()), "UTF-8"));
ServerURL = properties.getProperty("url"