Java方法等待,然后重新执行?
所以我的代码是这样的:Java方法等待,然后重新执行?,java,Java,所以我的代码是这样的: FetchUpdates() { if (checkupdatesComplete) { FetchUpdatedsneeded(); }else{ //wait until checkupdates == true, then re execute FetchUpdates(); } 基本上我被else的陈述困住了。。。有人知道我输入“/”的方法吗 这是我知道如何在检查所需更新后调用FetchUpdates方法的唯一方法 static File f
FetchUpdates() {
if (checkupdatesComplete) {
FetchUpdatedsneeded();
}else{
//wait until checkupdates == true, then re execute FetchUpdates();
}
基本上我被else的陈述困住了。。。有人知道我输入“/”的方法吗
这是我知道如何在检查所需更新后调用FetchUpdates方法的唯一方法
static File f = new File("C:\\Users\\Directory");
static File f1 = new File("C:\\Users\\File");
public void checkforUpdates() {
if (f1.exists) {
checkVersion();
}else{
F1Exists =false;
}
FetchUpdates();
}
Public void FetchUpdates() {
if (!F1Exists) {
try (InputStream in = URI.create("C:\\DownloadUrlHere").toURL().openStream()) {
Files.copy(in, Paths.get("C:\\DirectoryHere"));
}catch(Exception ex){}
}
当
checkupdates
设置为true
时,不要检查更新,只要在调用FetchUpdates
时获取更新即可。这不是一个做家庭作业的网站,你应该提供一些更详细的信息……不清楚你的环境是什么(ATM=“禁欲”直到结婚”?“Adobe Type Manager”?“空气涡轮马达”?),但在大多数环境中(图形应用程序、服务器等),人们永远不应该在程序内“等待”。这不是家庭作业,哈哈。这只是一件我已经坚持了大约2个小时的事情。&@Hot Licks我正在制作一个桌面程序(我游戏的启动器).我以前的更新系统完全是垃圾。把它放回去撇号,钥匙在退出钥匙下面。
while(!checkupdates){
FetchUpdatedsneeded();
if (checkupdates) {
execute FetchUpdates();
break;
}
}