5

I am working on a dynamic web project in Eclipse with Tomcat 7. All of my html, css and javascript files are inside the WebContent folder in the eclipse workspace. All the java files are inside the src folder. All works well for simple programs. But now I want to read a text file from the java programs. I am not sure where to put the text file in the eclipse workspace so that it is correctly deployed to the Tomcat webapps directory inside ./metadata folder of eclipse.

Riju Mahna
  • 6,718
  • 12
  • 52
  • 91

2 Answers2

0

You can use the ServletContext.getResourceAsStream() API.

An example can be found at this link . It suggests that the file should be kept in the /WEB-INF directory

Riju Mahna
  • 6,718
  • 12
  • 52
  • 91
-1

put ur files inside webroot folder or outside webroot folder any where it is possible to read files .

inside classes folder is good because of default classpath for webapplication

ravula's
  • 62
  • 1
  • 6