我是java新手,试图编写一个程序来访问excel文件中的数据。但是收到消息
线程“main”java.lang.Error 中的异常:未解决的编译问题:无法对非静态字段进行静态引用
编码:
package xl;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import jxl.*;
import jxl.Workbook.*;
import jxl.read.biff.BiffException;
public class xl {
public String path = "C:/Workbook.xls";
public File wb = new File(path);
public static void main(String[] args) throws IOException, BiffException {
Workbook work;
work = Workbook.getWorkbook(new java.io.File(wb));
Sheet sheet1 = work.getSheet(0);
Cell c1 = sheet1.getCell(0,0);
String xreader = c1.getContents();
System.out.println(xreader);
}
}
任何想法,我错在哪里......