I have a class that contains the following main method:
public static void main(String[] args) {
System.out.println("args.length: " + args.length);
if (args.length == 1) {
// do something
} else if (args.length == 2){
// do something
}
... Some code ...
}
The problem is that the arguments in command line are not read.
When I type ./program arg1 Arg 2 .... I always get args.length equals to 0. I tried to verify the length of arguments in other classes and I got the correct number
What could be the problem ?
java foo.bar.Baz arg1 arg2 ...- what is./program? (If it's a shell script you've written to start the application, that's probably where the problem is.)java -cp <...> your.MainClass arg1 arg2 ...