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 Different results for ServletContext.getRealPath Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Different results for ServletContext.getRealPath " Watch "Different results for ServletContext.getRealPath " New topic
Author

Different results for ServletContext.getRealPath

Reginald Law
Greenhorn

Joined: Jan 21, 2004
Posts: 19
I noticed that JRun tags on a file path seperator for the method ServletContext.getRealPath, where as Apache Tomcat does not append it on. I am calling the method from the init method in the servlet.

How does one get around this so code does not have to be changed from one application server to another one ?


SCJP 1.4
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

The following code (which has not been compiled or tested) assumes that all your other code *expects* your paths to end with /.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Different results for ServletContext.getRealPath
 
Similar Threads
Different results for ServletContext.getRealPath
Get Host appbase Path of a JSP in Tomcat
relative path problem
Path to config file
Getting absolute path of image file