0

I am doing an web application which reads a file as input and extracts its data and store it into Database.It's working well in eclipse workspace.And I exported that project as war file and deployed using tomcat,but StudentDAO class couldn't find the file.I am having input files in the 'res' folder.com.task3.StudentDAO accessing input file under res folder.Finally my doubt is where to place the res folder when I export the project as war file.

class StudentDAO{
    public StudentDAO(){
        // TODO Auto-generated constructor stub
        filePath="res/serverOut_2014-10-22.txt";
}
}
Ganeshkumar SR
  • 101
  • 1
  • 2
  • 10
  • possible duplicate of [How can I read file from classes directory in my WAR?](http://stackoverflow.com/questions/3888226/how-can-i-read-file-from-classes-directory-in-my-war) – Aleksandr M Oct 31 '14 at 10:46
  • Now the code working as war file in tomcat but not working in eclipse... I used filePath=Thread.currentThread().getContextClassLoader().getResource("/res/serverOut_2014-10-22.txt").getPath();..How to write same code that should work both in eclipse workspace and tomcat war file.. – Ganeshkumar SR Oct 31 '14 at 11:24

0 Answers0