Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
あるメソッドの実行に時間がかかり、完了したら次のメソッドを実行したいので、スリープを使用しています。これは私がしようとしているものです。
method1(); Thread.sleep(3000); method2();
メソッドを次々に実行するには、次のことができます
method1(); method2();
メソッド呼び出しの間にスリープする必要はありません。
私のmethod1はいくつかのシェルスクリプトを実行しています
この場合、次のようなものが必要です
Process process = Runtime.getRuntime().exec(commandLine); // wait for the process to finish. process.waitFor();