【发布时间】:2020-12-02 02:03:43
【问题描述】:
我试图描述最后执行的数据流作业,以检查特定的数据流作业是否正在运行、停止、失败或使用 java 执行。
我正在尝试使用 Runtime.getRuntime().exec(command) 执行 gcloud 命令
String command ="gcloud dataflow jobs describe $(gcloud dataflow jobs list --sort-by=CREATION_TIME --limit=1 --format=\"get(id)\") --format=json";
Runtime runTime = Runtime.getRuntime();
Process process = runTime.exec(command);
BufferedReader is = new BufferedReader(new
InputStreamReader(process.getInputStream()));
当我执行此代码时,我收到如下错误:
Exception in thread "main" java.io.IOException: Cannot run program "gcloud": CreateProcess error=2, The system cannot find the file specified
有人可以帮我解决这个错误吗?
【问题讨论】:
-
这能回答你的问题吗? Run cmd commands through Java
标签: java google-cloud-platform gcloud runtime.exec