Meaningless Drivel is fun!
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 Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Directory Creation" Watch "Directory Creation" New topic

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

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

Joined: Mar 22, 2000
Posts: 13037

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

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

Arpit Gadle
Ranch Hand

Joined: Dec 16, 2008
Posts: 69

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().

I agree. Here's the link:
subject: Directory Creation
It's not a secret anymore!