intellij idea – Caused by: java.io.IOException: CreateProcess error = 2, the system can not find the file specified with AWS

Getting problem Caused by: java.io.IOException: CreateProcess error = 2, the system can not find the specified file while running the java program from intellij, but when the same command is run from the cmd prompt, then it works correctly.

public class TestRunProgram {
empty main public static (String[] args) launches 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);
}}

Getting below problem after execution

                java.io.IOException: the program "aws" can not be executed: CreateProcess = 2 error, the system can not find the specified file
in java.lang.ProcessBuilder.start (ProcessBuilder.java:1048)
in java.lang.Runtime.exec (Runtime.java:620)
in java.lang.Runtime.exec (Runtime.java:450)
in java.lang.Runtime.exec (Runtime.java:347)