I have the following code for reading a excel sheet in Java using the Apache POI. Although the file exists, why does it give me a FileNotFound Exception?
import org.apache.poi.hssf.usermodel.HSSFSheet;
import java.io.FileInputStream;
import java.io.File;
public class ReadFromExcel {
public static void main(String[] args) {
FileInputStream file = new FileInputStream(new File("C:\\Personal\\test.xlsx"));
}
}
I just copied and pasted the File location from windows explorer so I know that the file exists for sure. Then Why can't Java find it?
Used same path with the "File" class instead of "FileInputStream" and it works fine. What is special about paths in the class FileInputStream?