Reputation: 15
I know how to get input from command-line. But if the input (file name) they pass in throws file not found exception, how would I have them try again until the file name entered is correct? (Java)
Upvotes: 0
Views: 170
Reputation: 57600
If the command-line arguments are invalid, just exit the program with the expectation (possibly made explicit via an error message) that the user will then run the program again with the correct arguments. I don't have any facts to back this up, but having the program remain running and harassing the user to input a new set of command-line arguments does not seem like good design.
Upvotes: 1