这是空指针错误。
你这样输出到页面看文件路径对不对
<%=application.getRealPath("\exam\1.xml")%>

解决方案 »

  1.   

    C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\csdn
                                                                       \file
                                                                            \file.jsp
                                                                            \a.txt
    <%

    String path = (request.getRealPath(""));

    //File f = new File("/csdn/file/a.txt");
    File f = new File(path +  "/file/a.txt");

    if (f.exists()) {
    out.print("hello world");
    } else {
    out.print("the path no files");
    }
    %>
      

  2.   

    很遗憾
    以上方法都试了
    一个不好用
    <%=application.getRealPath("\exam\1.xml")%>
    为null
    String path = (request.getRealPath(""));
    也为null
    曾怀疑application是不是不好用了
    可是rgf
      

  3.   

    File reportFile = new File(application.getRealPath("/exam/1.xml"));
      

  4.   

    试试monkeyhjl(爬上墙头等红杏) ( )的。
    你的path肯定有问题,要么\\exam\\1.xml,要么如楼上所说。当然不排除其他错误