MyException - 我的异常网
当前位置:我的异常网» Java Web开发 » jexcel读excel时报错,该怎么处理

jexcel读excel时报错,该怎么处理

www.MyException.Cn  网友分享于:2013-03-02  浏览:56次
jexcel读excel时报错
源码如下:
static   final   String   workFielUrl   =   "c:/jxlrwtest.xls ";

/**
  *   @param   argsb
  */
public   static   void   main(String[]   args)   {
java.io.OutputStream   fou   =   null;
java.io.InputStream   fin   =   null;
jxl.write.WritableSheet   writeSheet   =   null;
jxl.write.WritableWorkbook   writeWB   =   null;
jxl.Workbook   wb   =   null;
//   TODO   Auto-generated   method   stub
try   {
fou   =   new   FileOutputStream(workFielUrl);
fin   =   new   FileInputStream(workFielUrl);
File   f=new   File(workFielUrl);
wb=jxl.Workbook.getWorkbook(fin);
jxl.write.WritableWorkbook   copywb=jxl.Workbook.createWorkbook(new   File(workFielUrl),   wb);
jxl.write.WritableSheet   wsheet=copywb.createSheet( "abc ",   5);
copywb.write();
copywb.close();


在     wb=jxl.Workbook.getWorkbook(fin);时报错


异常如下:
jxl.read.biff.BiffException:   The   input   file   was   not   found
at   jxl.read.biff.File. <init> (File.java:124)
at   jxl.Workbook.getWorkbook(Workbook.java:268)
at   jxl.Workbook.getWorkbook(Workbook.java:253)
at   jexcel.JExcelUtil.main(JExcelUtil.java:27)

------解决方案--------------------
文件路径不对~~~~~~~~~
------解决方案--------------------
文件不存在。
你可以试试。
File file=new File( "d:\\template3333.xls ");
if(file.exists()){
System.out.println( " file.exists is "+file.exists());
}else{
System.out.println( " file.exists is "+file.exists());

}

能创建File并不是说file已经存在,只是创建了一个File实例而已。
------解决方案--------------------
还没有高手能解决吗?

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有