Results 1 to 2 of 2
Like Tree1Likes
  • 1 Post By Java Tip

Thread: How to create directory through Java Code

  1. #1
    Java Tip's Avatar
    Java Tip is offline Moderator
    Join Date
    Nov 2007
    Blog Entries
    Rep Power

    Default How to create directory through Java Code

    This program will create a directory to the given path.

    Java Code:
    public class MakeDirectory {
        public static void main(String[] args) {
            File f = new File("c:\\MyFolder");
    arc535 likes this.

  2. #2
    dbashby's Avatar
    dbashby is offline Senior Member
    Join Date
    Mar 2009
    Rep Power


    This is great but I would be grateful if you could let me know if this can be automated.

    I have a program that writes to a file, however when I build the project it deletes the dir that stores the file. So then the run fails because there is no dir, I then have to create the folder manually then run the application again within netbeans and everything works.

    I suppose my question is there a way to get round this.

    At the moment I have a seperate application that I run alongside my other 1 so it looks a little untidy.

    Any suggestions?

    Thanks in advance

Similar Threads

  1. Renaming underlying directory in Java project
    By Rodrigo Braz in forum Eclipse
    Replies: 3
    Last Post: 03-08-2009, 07:25 AM
  2. How to create ToolTip in Java 3d
    By roshithmca in forum AWT / Swing
    Replies: 0
    Last Post: 02-04-2008, 06:57 AM
  3. Create a new directory in existing Zip archive
    By satishbejgum in forum Advanced Java
    Replies: 1
    Last Post: 12-23-2007, 06:05 AM
  4. how to create a menu bar in java
    By tommy in forum New To Java
    Replies: 1
    Last Post: 08-05-2007, 07:43 AM
  5. Create a Calculator in Java
    By Albert in forum New To Java
    Replies: 2
    Last Post: 07-04-2007, 08:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts