In my CS class we use the terminal to run our codes, using the javac to cimpile and java to run. In my current assignment I'm receiving inputs from a file. The name of the file is given when inputing the command in the CMD (terminal) like this: "java -cp mypath\class text.txt" using this code:
if (args.length != 1) {
final String msg = "Usage: EmployeePay name_of_input file";
System.err.println(msg);
throw new IllegalArgumentException(msg);
}
final String inputFileName = args[0];
final File input = new File (inputFileName);
final Scanner in = new Scanner (input);
When running this with Eclipse, it throws the Exception. Is there a way in eclipse to do this command "java -cp mypath\class text.txt" without changing or adding anything to the code itself?