I am trying to read json data from a file I have in my WebContent
folder, not my WEB-INF
folder. Everything works when I use an absolute file path, but if I use another method to get the file path, the Java FileReader
cannot find the file.
I am using a Java FileReader
.
I have also tried using the below code, but it doesn't work:
String JSON_FILE = request.getServletContext().getRealPath("users.json");
Also, when I type in: users.json , after the base url, I can see the json data.
Any ideas?