If the input is interactive, i.e. from the console, I want to print a command prompt e.g. \">\"
But if it is redirected e.g. from a file, then I do not want to promp
You can make it interactive:
public static void main(String args[]) throws Exception {
String action = null;
Scanner in = new Scanner(System.in);
while (!((action = in.nextLine()).equalsIgnoreCase("exit"))) {
if (action.equalsIgnoreCase("open")) {
openConnections();
} else if (action.equalsIgnoreCase("close")) {
closeConnections();
}
}
}