开发者

Problem with execution after update download

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();
    } c开发者_C百科atch (IOException e) {
        //e.printStackTrace();
    }
}

The updates are downloaded but I'm not exactly sure if they're being installed. When I run the updater it downloads the file fine but execution I don't see any prompt of successfully updated or failed to update. Is there something I need to add to the save location of the update? Runtime.getRuntime().exec(saveTo);


Try uncommenting your exception handlers, then see what exception you are getting.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜