mkdir() is not creating the new directory

后端 未结 7 2157
庸人自扰
庸人自扰 2020-12-18 20:59

I am using Eclipse and jdk1.7. I am making a basic program using file handling, in which an output directory inside the directory is to be made. But when I run the program,

7条回答
  •  时光说笑
    2020-12-18 21:21

    mkdir needs the abstract path, not the relative path. try to use...

    File f2 = new File (f1, "C:\\");
    

    ... for example.

    From Java DOC:

    public boolean mkdir()

    Creates the directory named by this abstract pathname.

    Returns:

    true if and only if the directory was created; false otherwise

    Throws:

    SecurityException - If a security manager exists and its SecurityManager.checkWrite(java.lang.String) method does not permit the named directory to be created

提交回复
热议问题