I was so wrong.
Three things wrong. The first is pedantic: you need to import IOException. The second though is one of those "scream out loud at the universe* questions: why the heck are you calling print() instead of write()?
Finally, do you think maybe you might need to worry about buffering of System.out's stream?