This is my code:
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
public class Reader {
public static void read_excel() {
File excel = new File ("C:\\Users\\Username\\Desktop\\java-Tools\\data.xlsx");
FileInputStream fis = new FileInputStream(excel);
XSSFWorkbook wb = new XSSFWorkbook(fis);
}
This results in the following error message:
error: cannot find symbol
File excel = new File ("C:\\Users\\Username\\Desktop\\java-Tools\\data.xlsx");
symbol: class File
location: class reader
I have set the CLASSPATH for the jar files of the Apache POI library. Here is the content of the CLASSPATH varibale:
.;C:\Users\Username\Desktop\Code\Classes;C:\poi-3.12\poi-3.12-20150511.jar;C:\poi-3.12\poi-ooxml-3.12-20150511.jar;C:\poi-3.12\poi-ooxml-schemas-3.12-20150511.jar;C:\poi-3.12\ooxml-lib\xmlbeans-2.6.0.jar;C:\poi-3.12\lib\commons-codec-1.9.jar;C:\poi-3.12\lib\commons-logging-1.1.3.jar;C:\poi-3.12\lib\junit-4.12.jar; C:\poi-3.12\lib\log4j-1.2.17.jar;C:\poi-3.12\poi-examples-3.12-20150511.jar;C:\poi-3.12\poi-excelant-3.12-20150511.jar;C:\poi-3.12\poi-scratchpad-3.12-20150511.jar
I don't understand why the programme does not compile !