File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Java Interview Guide
this week in the
Java in General
Get path of file in java class in web application
Joined: Dec 01, 2011
Dec 16, 2011 01:47:53
HI am quite new to
programming and till now I am doing XSLT transformation on static location files
File xmlFile = new File("D://Dashboard.xml");
File xsltFile = new File("D://Dashboard.xslt");
But ,now i have kept these 2 files into path
When i run my project it says file cannot found.
Kindly tell how do I get the actual path of these files so that at run time it picks the file from root directory and perform some operations.
Joined: Oct 27, 2005
Dec 16, 2011 03:03:44
Check out ServletContext and its getRealPath method. That takes a path relative to the web application's root folder, and turns it into an absolute path.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions
How To Answer Questions
Joined: Oct 13, 2005
Dec 16, 2011 05:00:21
And welcome to the Ranch
I agree. Here's the link:
subject: Get path of file in java class in web application
jasper in a WebApp
Ant javac task error with Rational application developement studio 7
How to write dynamic images to web server?
root.getRootElement() is throwing an NullPointerException
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015