目录仅在localhost上运行时创建

时间:2016-04-22 04:36:48

标签: java eclipse

美好的一天!我只是想知道为什么我的创建目录的代码只适用于localhost。当项目部署到实时服务器并在客户端访问时,它不再起作用。

String path = System.getProperty("user.home") + File.separator + "Documents";
        path += File.separator + ("CUSTOM_FOLDER");
        File customDir = new File(path);
        customDir.mkdirs();

更新

我刚刚将代码修改为

File outReportDir = new File("C:/CUSTOM_FOLDER");
        outReportDir.mkdir();

然后立即创建文件夹。问题是当客户端单击按钮创建文件夹时,该文件夹在放置war文件的服务器的C:\上创建,而不是在用户自己的C:\为什么?谢谢您的时间。

0 个答案:

没有答案