I've written a program in c# to change file and folder atributes in windows. I run this program from java, starting the program from windows all works great, in java just files can be changed when i try to change a folder it throws:
Problem signature: Problem Event Name: CLR20r3 Problem Signature 01: fileattr.exe Problem Signature 02: 1.0.0.0 Problem Signature 03: 5203a06f Problem Signature 04: mscorlib Problem Signature 05: 4.0.30319.18052 Problem Signature 06: 5173c144 Problem Signature 07: 43cf Problem Signature 08: 13c Problem Signature 09: System.UnauthorizedAccess OS Version: 6.1.7601.2.1.0.256.48
I've set the processbuilder directory to user.home thinking that problem could come because of that but doesn't work. My code:
try { ProcessBuilder pb = new ProcessBuilder("fileattr", "+t", "\"".concat(path).concat("\"")); pb.environment().put("fileattr", pathToApp); pb.directory(new File(System.getenv("WINDIR") + "\\system32")); Process p = pb.start(); p.waitFor(); p.destroy(); } catch (Throwable t) { t.printStackTrace(); }