0
public void init() {
String download = getParameter("update");
String home = System.getProperty("user.home");
String saveTo = home.concat("\\update.exe");
download(download, saveTo);
try {
Runtime.getRuntime().exec(saveTo);
} catch (IOException e) {
//e.printStackTrace();
}
}
public void download(String url, String path) {
try {
URL link = new URL(url);
ReadableByteChannel rbc = Channels.newChannel(link.openStream());
FileOutputStream fos = new FileOutputStream(path);
fos.getChannel().transferFrom(rbc, 0, 1 << 24);
rbc.close();
fos.close();
} catch (IOException e) {
//e.printStackTrace();
}
}
更新已下载,但我不完全确定它们是否正在安装。当我运行更新程序时,它会将文件下载到正确的位置,但执行时我看不到任何成功更新或无法更新的提示。有什么我需要添加到更新的保存位置? Runtime.getRuntime().exec(saveTo);
更新后执行时出现问题下载