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 problem with getRealPath Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "problem with getRealPath" Watch "problem with getRealPath" New topic
Author

problem with getRealPath

Janardhan Mudduluru
Greenhorn

Joined: Jul 09, 2009
Posts: 4
Hi

I am using getRealPath in my application which is deployed in application server as war file.

getRealPath is returning null,So i am trying to use getResource here in lieu of getRealPath.

suggest me whether it is a correct approach or not?

and also is there any method to convert URL to String type.

Need Urgently.....

your Response will be much appreciated.

Thanks in advance.

Varma
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

The javadoc has a hint for your problem.

Let us know what you are trying to do. That will help us answer your question better


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
bhaskarvignesh chandra sekaran
Greenhorn

Joined: Jun 27, 2009
Posts: 17


Try this piece of code

request.getContextPath()+"/xxx/public_html/ YOUR CONTEXT DIR HERE");


SCJP, SCWCD,preparing for SCDJWS
View my facebook profile
http://www.facebook.com/bhaskarvignesh
Janardhan Mudduluru
Greenhorn

Joined: Jul 09, 2009
Posts: 4
Thanks Deepak and chandra for your quick responses....

i have solved this issue by removing getRealPath from my code.....in lieu i did use getResourceAsStream method directly without invoving getRealPath mehtod in between.

I am using this code in FrameWorkManager plugin provided by struts.

Thanks again

yours Janardhan.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with getRealPath