简体   繁体   English

使用Java在窗口的程序文件中创建文件夹

[英]Creating folder in window's Program Files using java

I am creating an installer for a standalone application, which requires to copy all its related folders under C:\\Program Files\\Company\\Product . 我正在为一个独立的应用程序创建安装程序,该安装程序需要将其所有相关文件夹复制到C:\\Program Files\\Company\\Product I am using below code to achive this: 我正在使用下面的代码来实现这一目标:

boolean files = new File("C:\\Program Files\\Company\\Product").mkdirs();
    if (files) {

            System.out.println("Multiple directories are created!");
        } else {
            System.out.println("Failed to create multiple directories!");

    }

However , folders are not getting created surely because there is space in Program Files. 但是,由于程序文件中有空间,因此不能确定创建文件夹。 How to get it done.? 如何完成它? I do have admin rights to create folders in Program Files. 我确实具有在“程序文件”中创建文件夹的管理员权限。

Program looks fine. 程序看起来不错。 It will work if you run in administrative mode. 如果在管理模式下运行,它将起作用。 (For ex: Start -> Right click command prompt -> Run as administrator) (例如:开始->右键单击命令提示符->以管理员身份运行)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM