Possible Duplicate:
Why do I get the “Unhandled exception type IOException”?
I'm trying to solve Euler #8 using the following algorithm. Problem is, whenver I modify the line I have the giant comment on, the error Unhandled Exception Type IOException
appears on each line that I've marked with the comment //###
.
private static void euler8()
{
int c =0;
int b;
ArrayList<Integer> bar = new ArrayList<Integer>(0);
File infile = new File("euler8.txt");
BufferedReader reader = new BufferedReader(
new InputStreamReader(
new FileInputStream(infile), //###
Charset.forName("UTF-8")));
while((c = reader.read()) != -1) { //###
char character = (char) c;
b = (int)character;
bar.add(b); /*When I add this line*/
}
reader.close(); //###
}