I had to disable my UAC in the registry. Even though the UAC was off already
Give Java permission to write a file in windows 8? [closed]
-
01-07-2023 - |
Question
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);
La solution
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow