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 Directory Creation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Directory Creation" Watch "Directory Creation" New topic
Author

Directory Creation

Arpit Gadle
Ranch Hand

Joined: Dec 16, 2008
Posts: 69

Dear All,
I want to create a directory(in tomcat) inside my current webapplication i.e DemoDirApp. This is the code of the servlet. This servlet code creates the directory in C:\ where the tomcat is installed



Need your help


Regards
Arpit U. Gadle
Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
Uhm, what exactly is your problem ? Do exceptions occus ?


JDBCSupport - An easy to use, light-weight JDBC framework -
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12760
    
    5


If you expected that directory to be relative to your application, you have the wrong idea.

The class java.io.File deals with operating system directories, to get the translation from application relative to operating system, look into the ServletContext getRealPath() documentation.

Bill
Arpit Gadle
Ranch Hand

Joined: Dec 16, 2008
Posts: 69

Hi,
Thanks Williams,

There is indeed know that the path which I used is wrong and thanks for giving the correct explanation. Will check with the getRealPath().


Thanks
Arpit
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Directory Creation
 
Similar Threads
Opening a file
problem with tomcat embedded application
help required about URLConnection
kindly help me in redirecting....... as soon as possible
getServletContext() returning null