I am trying to use the bash shell command "read" in java however i get an exception saying there is no such program or directory even though i can use the command directly in the shell.
This is my java method.
public void waitForKeyPress()
{
ArrayList<String> cmd = new ArrayList();
cmd.add("read");
cmd.add("-n1");
cmd.add("-s");
ProcessBuilder pb = new ProcessBuilder(cmd);
pb.inheritIO();
try {
Process p = pb.start();
p.waitFor();
} catch(Exception e)
{
Printer.printError(pName, "Could not wait for key press.", e);
}
}
This is all in effort to make a "press any key to continue" function so if a different approach exists let me know. thanks