First of all, it has nothing to do with Eclipse, which is just the IDE. When you run your application, it's out of equation.
The problem is very simple. The variable
args
means the array of string each representing
command-line argument written in the command line when you start the application. Please see:
https://en.wikipedia.org/wiki/Entry_point#Java[
^].
Now, if you simply start the application with no command line, no arguments, the length of this array is zero. There are no any element, including, of course,
args[0]
.
Solution: always check up the length of an array before accessing any element of an array by index.
(No, there is no a need to debug anything in this particular case; the problem is crystal clear. :-))
—SA