IOException inherits from Exception. All Exceptions do. When you catch Exception first, you will catch all exceptions (including IOException). Make sure that your catch(Exception e) is the last catch in the list otherwise all other exception handling will be effectively ignored.