Probably because the *
is getting expanded by the shell from which you are running Java. Try printing out the contents of args[0]
, I think you'll find that the pattern you're matching against isn't the one you think you're matching against.
You could fix this by quoting your argument - 'a*'
instead of just a*
.