I am using a servlet to open a file stream for a file located in /WEB-INF/files
When I use the following code I get an error stating that a file does not exist in the location:
String fileLocation = "files/myFile.dat";
FileInputStream fstream = new FileInputStream(fileLocation);
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
while ((strLine = br.readLine()) != null) {
// process file line-by-line
}
in.close();
The absolute path to the file is: C:/NetBeansProjects/myApp/web/WEB-INF/files/myFile.dat
How can I refer to documents from a servlet without getting an error?
I am using SpringFramework MVC if that matters to this issue.
Regards...