Hi All,

When I execute the following code in my project folder, it creates the file
in my current folder(project folder).

import java.io.File;
public class CreateFile{
      File f = null;
      try{
         f = new File("test.txt");
         bool = f.createNewFile();
         System.out.println("File created: "+bool);
         }catch(Exception e){
         e.printStackTrace();
      }
}

I am now calling this class in my servlet.
The servlet is executing perfectly on the tomcat, however, the file is
getting created in the tomcat's bin folder instead of my project folder
placed in the webapps.

If I specify the path, then it creates the file on that location , however,
that will be hardcoding and will not work on the other computer.

Please help.
Thanks in advance
Hyder!

Reply via email to