File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Not able to find a File in servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Not able to find a File in servlet" Watch "Not able to find a File in servlet" New topic
Author

Not able to find a File in servlet

A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979
Hi,

I am using WSAD...I have an application...When i run it as a standalone application...in one of the classes..a xyz file is read ...and the execution completes successfully...

But when the same program is changed to a servlet....and i call the same intermediate class...that reads the xyz file..it says file cannot be found...

Wonder why??? I have even added the file to manifest.mf file....


Regards
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18987
    
    8

Moving to the Servlets forum.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10288
    
168

How are you reading the file? Can you post the code?
[ June 13, 2007: Message edited by: Jaikiran Pai ]

[My Blog] [JavaRanch Journal]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Are you using an absolute path to find the file on the server?

If not, post the code that locates the file.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979
its not a absolute path...but a relative path
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61764
    
  67

Since in a servlet there is no concept of a current directory, what are you expecting the path to be relative to?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Again, if you're not using an absolute path, you'll need to post the code that you're using to locate the file.

If you won't or can't do that and you can't describe exactly how you're trying to locate your file using a relative path, nobody here will be able to help you.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Not able to find a File in servlet