You can "catch" the exception to keep it from leaving that method:
try {
c = ImageIO.read(new File("poker table.jpg"));
} catch(IOException e) {
e.printStackTrace();
}
Here the printStackTrace()
will just print a message to the console if this exception does happen (for example, if the image file is not found). If there is no exception, the catch
block is skipped.