Получение проблемы Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
при выполнении java-программы из intellij, но при выполнении той же команды из командной строки cmd, она работает правильно.
public class TestRunProgram {
public static void main(String[] args) throws IOException {
String commandRun = "aws apigateway get-api-keys --profile awsProdUser --region eu-west-1";
System.out.println(commandRun);
Runtime rt = Runtime.getRuntime();
Process pr = rt.exec(commandRun);
}}
Получение ниже проблемы после выполнения
java.io.IOException: Cannot run program "aws": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at java.lang.Runtime.exec(Runtime.java:620)
at java.lang.Runtime.exec(Runtime.java:450)
at java.lang.Runtime.exec(Runtime.java:347)