Define the "main directory of your Java app"? There is no such beast.
You want to be very careful when doing things like this, for security concerns. Best to define a directory in a property file and use that as a base directory for your application. Then, as already said, it is just a use of .mkdir{,s}()
to achieve what you want.
And @C.Reed also rightly says that you should check for mkdir()
's return value: Java's File API is hugely flawed in that it will not throw an exception when directory/file creation/move will fail. Fortunately, Java 1.7 will cure that with its new APIs.
(an example I encountered is seeing code which would fail to .move()
a file around: the problem is that it worked on the dev's machine, but on the production machine the directory was to be moved on another filesystem --> havoc)
Hint: use Apache's commons-io