My code works on my windows 7 machine, however it doesn't work on my windows 8 computer.

I get this error:

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

The code creates a jpg file in C:\ . This is a permission problem with java and windows 8. I gave myself read and write privleges to my c drive but it still doesn't work. Is it there some permission settings that I can change with the JVM?

more code:

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);
有帮助吗?

解决方案

I had to disable my UAC in the registry. Even though the UAC was off already

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top