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
create a file in the root directory
Joined: Jul 31, 2008
Apr 20, 2009 13:07:05
based on some user action I need to create a file on the server inside the project's root directory. The url of my application is :
The name of the file is DeskItems.xml.
I tried to get the application Context path and appended that to the file name by using :
getServletContext.getPath("/") + "/DeskItems.xml";
But this approach is not working and I get an exception saying FileNotFound. I am using
Please help me out in resolving this issue.
SCJP 80% SCWCD 89%
Author and all-around good cowpoke
Joined: Mar 22, 2000
Apr 20, 2009 14:59:00
Look at the
getRealPath() method JavaDocs.
Java Resources at
I agree. Here's the link:
subject: create a file in the root directory
Creating a JAR file contains TLD-file.
Saving file at server
Directory Creation on FTP Server using Java Program
Save a file on the application root
Simple Servlet Not Working
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014