使用java写一个发送adb命令:"adb reboot"的代码
时间: 2023-06-02 20:06:16 浏览: 61
可以使用以下Java代码发送adb命令:"adb reboot"。
```java
import java.io.*;
public class AdbCommand {
public static void main(String[] args) {
String command = "adb reboot";
try {
// Execute command
Process process = Runtime.getRuntime().exec(command);
// Wait for command to finish
process.waitFor();
// Print output
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
}
}
```