| 

.NET C# Java Javascript Exception

2
Wie kann ich in Java die Zugriffsrechte auf eine Datei ändern. Das OS ist Windows.
29.07.2009
cephyr 53 1 3
2 Antworten
6
java.io.File hat dafür ab Java6 eine API:
Methods to set or query file permissions:

* setWritable(boolean writable, boolean ownerOnly) and setWritable(boolean writable) set the owner's or everybody's write permission
* setReadable(boolean readable, boolean ownerOnly) and setReadable(boolean readable) set the owner's or everybody's read permission
* setExecutable(boolean executable, boolean ownerOnly) and setExecutable(boolean executable) set the owner's or everybody's execute permission
07.09.2009
cdaszenies 136 1 2
3
Runtime.getRuntime().exec("chmod abc " + filepath)
bzw
Runtime.getRuntime().exec("subinacl def " + filepath)
07.09.2009
cakruege 61 1 1
4
chmod geht soweit ich weiß doch nur unter Linux oder?
Corvan 08.09.2009
Es ist ja ein Kommandozeilenprogramm unter Unix, demnach sollte es wohl ausschließlich unter Linux funktionieren.
Forlan 10.11.2009
1
Er könnte ja stattdess das cacls Programm unter Windows nutzen.
Runtime.getRuntime().exec("cacls" + filepath + "/g Benutzer:f")
Für die Programmsyntax in die Windows Hilfe sehen.
Lord_Pinhead 13.11.2009

Stelle deine Java-Frage jetzt!