Make a new Folder with Java

Discussion in 'Mac Programming' started by Eraserhead, Apr 3, 2006.

  1. Eraserhead
    Expand Collapse
    macrumors G4

    Eraserhead

    Joined:
    Nov 3, 2005
    Location:
    UK
    #1
    Hey

    I wondered how you created a new folder or directory with java, when in xcode with the code

    File f=new File("/test");
    if(f.exists()==false){
    f.mkdirs();​
    }

    it produces two cannot find symbol errors on the first line. Why is this? how do I create a directory with Java on Mac OS X?

    Thanks

    Matthew
     
  2. robbieduncan
    Expand Collapse
    Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    Java 101: Have you imported java.io.File? If not then you will not be able to use it like that (you could replace File with java.io.File)...
     
  3. Eraserhead
    Expand Collapse
    thread starter macrumors G4

    Eraserhead

    Joined:
    Nov 3, 2005
    Location:
    UK

Share This Page