[Solved] “unreported exception IOException; must be caught or declared to be thrown”. Have a look on the coding [duplicate]


You need to handle the exception for Runtime.getRuntime().exec("calc");.

Try this:

else if(e.getActionCommand().equals("Window Calculator")){
    try
    {
        Runtime.getRuntime().exec("calc");
    }
    catch(IOException ioe)
    {
        ioe.printStackTrace();
    }
}

From OP comments:

If i catch the exception,how will it help..the code that i want to use will not be executed by this

This will not help you to run your code which has caused exception, but it can help you to run your other parts of program even if exception occurs.

0

solved “unreported exception IOException; must be caught or declared to be thrown”. Have a look on the coding [duplicate]