I am working on a project for my grad school. And I am using Servlets for that. Now, I need to read a HTML file (that is located on the server's webapp directory itself) from my servlet.
For example, the sample code is:
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
    PrintWriter pw = response.getWriter();
    response.setContentType("text/html");
    StringBuilder sb = new StringBuilder();
    try{
    FileReader fr = new FileReader(new File("..\\..\\WebContent\\index.html"));
    int ch;
    while((ch = fr.read()) != -1)
    {
        sb.append((char)ch);
    }
    pw.print(new String(sb));
    fr.close();
    }catch(Exception exc){
        exc.printStackTrace();
    }
}
The above code returns an exception: FileNotFoundException even though the index.html file exists. What is the remedy for this? Is there a workaround?
And BTW, I am using the Eclipse JEE Mars IDE along with Tomcat 7 Web Server
