Results 1 to 2 of 2
  1. #1
    manginion is offline Member
    Join Date
    May 2014
    Posts
    1
    Rep Power
    0

    Lightbulb Creating File Directory

    Hi There!

    I am working on a java logic game and I want it to be able to work on other people's Mac's, so I tried to figure out how to make it create a folder in which it can create files. The file creating is going fine however the folder never seems to create
    ;(.

    Here is the code I attempted to use:

    File logicFile = new File("/Library/Application Support/LogicGameSupport");
    if(!logicFile.exists()){
    if(logicFile.mkdir()){
    System.out.println("Directory success");
    }else{
    System.out.println("Directory failed");
    }
    }

    Thankyou for your help :)

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,758
    Rep Power
    5

    Default Re: Creating File Directory

    Are you sure you don't need to use "~/Library" ? I don't know anything about MacOS, but I found this in Google:

    18 ways to view the ~/Library folder in Lion and Mountain Lion | Macworld

    It seems the Library is going to be in your home folder, not in the root of the filesystem. You can get the user home folder in Java using System.getProperty("user.home");
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. Creating File inside a Directory
    By viswanadh7 in forum AWT / Swing
    Replies: 2
    Last Post: 06-27-2013, 07:18 PM
  2. Creating a new directory using new File().mkdir()
    By dalythe in forum New To Java
    Replies: 4
    Last Post: 06-27-2013, 10:50 AM
  3. Creating a Group in Active Directory
    By Bumbsiii in forum Advanced Java
    Replies: 6
    Last Post: 01-17-2011, 08:09 AM
  4. Replies: 2
    Last Post: 05-11-2009, 10:07 AM
  5. [SOLVED] File chooser selecting file from directory...?
    By prabhurangan in forum AWT / Swing
    Replies: 12
    Last Post: 06-18-2008, 04:08 AM

Tags for this Thread

Posting Permissions

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