读文件报错.解决办法

   阅读
读文件报错...
public static void main(String[] args) {
  testReadTable testReadTable1 = new testReadTable();
  testReadTable1.testTable();
  }
   
  public void testTable() {
  Document doc = null;
  try {
  doc = new Document();
  doc.open("e:/test4.doc");
  //读取第一张表,从首行(表头)开始读取
  List tableData = doc.readTable(1, 1);
  for (int i = 0; i < tableData.size(); i++) {
  List rowData = (List) tableData.get(i);
  for (int j = 0; j < rowData.size(); j++) {
  System.out.print("|" + rowData.get(j));
  }
  System.out.println("|");
  }
  }
  catch (Exception e) {
  e.printStackTrace();
  }
  finally {
  try {
  if(doc!=null) doc.close(false);
  }
  catch (Exception e) {
  e.printStackTrace();
  }
  }
  }
}

跑到doc.open("e:/test.doc")这步就报错了,为什么,我把路径改为doc.open("e:\\test.doc")也同样报错。。


------解决方案--------------------
把报错的内容贴出来.
------解决方案--------------------
探讨
public static void main(String[] args) {
testReadTable testReadTable1 = new testReadTable();
testReadTable1.testTable();
}

public void testTable() {
Document doc = null;
try {
……

------解决方案--------------------
Document 什么类型声明,建议你把代码贴全了吧
还有你检查E:/test.doc这个文件是否存在,如果不存在肯定是要报错
阅读