有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

是否授予Java在windows 8中编写文件的权限?

我的代码在我的windows 7计算机上运行,但在我的windows 8计算机上不运行

我得到了这个错误:

java.io.FileNotFoundException: C:\Drawing.jpg (A required privilege is not held by the client)

代码在C:\中创建一个jpg文件。这是java和windows 8的权限问题。我给了自己读写c盘的权限,但它仍然不起作用。是否有一些权限设置可以随JVM更改

更多代码:

String dir = "C:\\Drawing.jpg";
 BufferedImage image = componentToImage(component, null);

        File file = new File(dir);
        file.setWritable(true);
        file.setReadable(true);
        file.setExecutable(true);

        System.out.println(file.canWrite()); //this returns false

        ImageIO.write(image, "jpg", file);

共 (0) 个答案