I have placed the source file in all possible locations. But still I am getting the same problem.
The problem is not where the file is but the way you are referring to it. If you are not giving a complete path but using the "filename.typ" only, it will never work reliably. The reason being that with just the filename, the JVM assumes the "current" directory - something you have utterly no control over in the servlet environment. Either code a complete path or use something like the ServletContext getRealPath method. Bill
Use the getResourceAsStream(String path) method of the ServletContext object. The path must begin with a "/" and is interpreted as relative to the current context root. For eaxmple if you have a file called 'test.txt' in the context root folder of your web-app,
Author and all-around good cowpoke
Joined: Mar 22, 2000
Moreover, doing file I/O or database operations in servlet is not a good practice.
Perhaps the intended statement was related to doing file I/O or database operations inside the servlet class code - for instance the service method. You will find it much easier to test and debug if such operations are in "helper" classes. Bill
[ November 25, 2005: Message edited by: William Brogden ] [ November 25, 2005: Message edited by: William Brogden ]