Closing BufferedReader and System.in

Solution 1:

Looks like you need:

http://commons.apache.org/io/apidocs/org/apache/commons/io/input/CloseShieldInputStream.html

Wrap that around System.in before making your reader, and then all will be well, since you won't do that when you are using a FileInputStream.