简体   繁体   English

Java程序未捕获异常

[英]Exception not caught in java program

Im running an eclipse based Java application and im unable to catch the exception. 我正在运行基于Eclipse的Java应用程序,但无法捕获该异常。 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); 我试图读取一个excel文件并获取其内容。下面是示例代码该程序能够识别excel文件,并且当该程序尝试创建一个新的xssfworkbook = new XSSFWorkbook(file);时,执行停止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. 我在课程路径中提供了所有必需的jar。 But unable to catch the exception. 但是无法捕捉到异常。 Any help on this is much appreciated. 任何帮助对此表示感谢。

运行时异常可能正在发生,正在停止您的应用程序。

Try setting classpath properly using maven or something else. 尝试使用Maven或其他方法正确设置类路径。 I guess the problem is not Exception 我想问题不在于异常

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM