I\'m designing a little software in Java. I don\'t know the term/definition to what I\'m doing, but I\'m prompting commands from Java to the terminal. Something like this:>
make the follows, in this example I go create a folder /var/lock and set your permissions to 777:
String[] command = {
"osascript",
"-e",
"do shell script \"mkdir -p /var/lock && chmod 777 /var/lock\" with administrator privileges" };
Runtime runtime = Runtime.getRuntime();
try {
Process process = runtime.exec(command);
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(process.getInputStream()));
String line;
while ((line = bufferedReader.readLine()) != null)
System.out.println(line);
} catch (IOException e) {
e.printStackTrace();
}
on linux maybe you can make this with gksudo but I not test it, after I go testing and post here the results.