A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Refactoring for Software Design Smells: Managing Technical Debt
this week in the
OO, Patterns, UML and Refactoring
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 ServletContext getRealPath() method JavaDocs.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: create a file in the root directory
Simple Servlet Not Working
Save a file on the application root
Directory Creation on FTP Server using Java Program
Creating a JAR file contains TLD-file.
Saving file at server
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015