'Call the program with exactly one argument result
Keep getting error of "Call the program with exactly one argument!", but am unsure where I need to make changes to run the program correctly. Thanks!!
class Main {
private static ArrayList<ArrayList<int[]>> list;
public static void main(String[] args) throws IOException {
if (args.length != 3) {
System.out.println("Call the program with exactly one argument!");
System.out.println("argument 1: path to map file");
System.out.println("argument 2: path to airports file");
System.out.println("argument 3: path to flights file");
System.exit(-1);
}
Solution 1:[1]
You have to call your main method with three parameters as you point in your code (args.length). In order to call your method via command line:
- java Main.java param1 param2 param3
If you want to call main method using only one parameter, then you'll get println messages you write.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Mehdi Rahimi |
