vr3w3c9
vr3w3c9

Reputation: 1178

Exception not caught in java program

Im running an eclipse based Java application and im unable to catch the exception. Im trying to read an excel file and get its contents.Below is the sample code The program is able to identify the excel file and the execution stops when the program tries to create a new xssfworkbook = new XSSFWorkbook(file); object.

FileInputStream file = null;
    XSSFWorkbook xssfworkbook = null;
    try
    {
        //TODO Read file from Actual Path
        file = new FileInputStream("D:\\Import_Model_1.xlsx"); 
        xssfworkbook = new XSSFWorkbook(file);
    }
    catch(IOException e)
    {
        // TODO Handle the IO Exception with Logs, and User Friendly Message to User
        e.printStackTrace();
    }
    catch( Exception e)
    {
        e.printStackTrace() ;
    }

The execution of the program halts abruptly without specifying the cause. I have all the required jars available in the class path. But unable to catch the exception. Any help on this is much appreciated.

Upvotes: 2

Views: 265

Answers (1)

Debaprasad
Debaprasad

Reputation: 127

Try setting classpath properly using maven or something else. I guess the problem is not Exception

Upvotes: 0

Related Questions