Mila Krumova
Mila Krumova

Reputation: 29

Program used to run, now giving ArrayIndexOutOfBounds Exception?

I'm trying to run a code that my teacher posted online. It takes as input an image (BufferedImage img = ImageIO.read(new File(args[0]));

The first time I ran it it worked fine, now it's giving me ArrayIndexOutOfBounds Exception at the line above.

Upvotes: 1

Views: 344

Answers (1)

Patashu
Patashu

Reputation: 21783

Maybe you didn't pass it any command line arguments? Then args would have a length of 0 and [0] would cause an array index out of bounds exception.

Upvotes: 3

Related Questions