dee nee wrote:
i have tried using above method on getting the path, but what i was getting:
This is correct behavior. If you only specify a file name, the path is assumed to be the working directory (i.e. the directory an application started in). The File constructor does not search the file system nor does File care whether an actual file exists on the file system (There are methods to search and to check existence).
If you want to locate an image (or some other file), the best practice is to package it in your application and use Class.getResource() to locate it. This insures that your application is self-contained and easy to deploy elsewhere. If you can't do this for whatever reason, I'd put a directory on the classpath and still use Class.getResource(). Failing that, I'd make the directory name a parameter to the web application (see
example here), again, trying to make the application as portable as possible. And don't forget the security precautions that I specified earlier.