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);
업데이트 다운로드 후 문제가 발생했습니다.