in the tomcat6 server I have a project that contains a servlet,
I called in a servlet:
BufferedWriter out = new BufferedWriter(new FileWriter("file.txt"));
out.write("text text text");
out.close();
it creates the file in the directory of eclipse.exe cons I want them to create in the directory of the project.
how do
In Servlet:
Note: It will work when you will deploy it in tomcat and run from out side eclipse.
As eclipse has its own internal structure when it deploy the web application.
To check differnce put
System.out.println("File Path: " + path);in your servlet.