Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2005

Tip: Looking for answers? Try searching our database.

creating directories

Thread view: 
Marcelo - 07 Nov 2005 19:23 GMT
Hello,

I would like to know if it is possible to create directories from JAVA
without using the Process class (neither the Runtime class).

I would like just to create some directories automaticly
(platform-independent)

thank you very much,

Marcelo
Benji - 07 Nov 2005 19:29 GMT
> Hello,

> I would like to know if it is possible to create directories from JAVA
> without using the Process class (neither the Runtime class).

> I would like just to create some directories automaticly
> (platform-independent)

> thank you very much,

create a new File object with the name of the directory you want to create,
and call mkdir() on it.

Signature

Of making better designs there is no end,
 and much refactoring wearies the body.

Marcelo - 07 Nov 2005 20:01 GMT
>>Hello,
>
[quoted text clipped - 8 lines]
> create a new File object with the name of the directory you want to create,
> and call mkdir() on it.

Do you mean

File file = new File("mkdir() whatever/here.txt");

seems a little bit strange...

MArcelo
Chris Smith - 07 Nov 2005 20:08 GMT
> > create a new File object with the name of the directory you want to create,
> > and call mkdir() on it.

> Do you mean
>
> File file = new File("mkdir() whatever/here.txt");

No, that's not what Benji meant.  You appear to be struggling with the
very basics of the Java programming language.  If so, it would be wise
to back off and spend more time getting familiar with objects and
methods before worrying about learning APIs.

What Benji meant was:

   new File(pathName).mkdir();

Where pathName is a String variable containing the path of the directory
you want to create.

Signature

www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation

Jeffrey Schwab - 07 Nov 2005 20:13 GMT
>>> Hello,
>>
[quoted text clipped - 17 lines]
>
> MArcelo

import java.io.File;
import java.io.PrintWriter;

public class Mkdir {
        static PrintWriter err = new PrintWriter(System.err, true);

        public static void main(String[] args) {
                if (args.length != 1) {
                        err.println("usage:  java Mkdir <dirname>");
                        System.exit(1);
                }

                new File(args[0]).mkdir();
        }
}
Marcelo - 07 Nov 2005 21:21 GMT
>>>> Hello,
>>>
[quoted text clipped - 33 lines]
>         }
> }
thanks alot

Marcelo
Roedy Green - 08 Nov 2005 03:00 GMT
>I would like to know if it is possible to create directories from JAVA
>without using the Process class (neither the Runtime class).

see http://mindprod.com/jgloss/file.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.