日期:2014-05-18  浏览次数:20660 次

我用poi读excel,在window下没有问题,但把程序放到linux上时,读取客户端的excel文件报错,不知道如何解决
我用poi读excel,在window下没有问题,但把程序放到linux上时,读取客户端的excel文件报错,不知道如何解决?
错误:
C:\a.xls  
You   chose   the   file   C:\a.xls.  

It 's   contents   are:   Error   occurred:   C:\a.xls   (No   such   file   or   directory)  

但在window下完全正常
我试着把c:\a.xls中的 "\ "   改为 "/ "还是不行,那位知道如何改呢,多谢

读excel的poi如下:
-------------------------------------------------------
<%@page   contentType= "text/html;   charset=gb2312 "   import= "java.io.*,org.apache.poi.poifs.filesystem.POIFSFileSystem,org.apache.poi.hssf.record.*,org.apache.poi.hssf.model.*,org.apache.poi.hssf.usermodel.*,org.apache.poi.hssf.util.* "   %>
<html>
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 ">
<title> 资金文件 </title>
</head>
<body>
An   example   of   using   Jakarta   POI 's   HSSF   package   to   read   an   excel   spreadsheet:  
<form   name= "form1 "   method= "post "   action= " ">
    <p> Select   an   Excel   file   to   read. </p>
    <p>  
        <input   name= "xls_filename "   type= "file "   onChange= "form1.submit() "   size= "90 ">
        <input   type= "submit "   name= "Submit "   value= "提交 ">
    </p>
</form>
<%
String   filename   =   request.getParameter( "xls_filename ");  
out.println(filename);
if   (filename   !=   null   &&   !filename.equals( " "))   {
%>
<br> You   chose   the   file   <%=   filename   %> .  
<br> <br> It 's   contents   are:  
<%
                        try
                        {

                                //   create   a   poi   workbook   from   the   excel   spreadsheet   file
                                POIFSFileSystem   fs   =
                                        new   POIFSFileSystem(new   FileInputStream(filename));
out.println( "fs= "+fs);
                                HSSFWorkbook   wb   =   new   HSSFWorkbook(fs);

                                for   (int   k   =   0;   k   <   wb.getNumberOfSheets();   k++)
                      &nbs