You will need chmod, and you can possibly do this by running a system command like:
Indeed, all you need to do is knock down something like this:
Runtime.getRuntime().exec("chmod u+x "+FILENAME);
, stdin/stderr, - :
Process p = Runtime.getRuntime().exec("chmod u+x "+FILENAME);
BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream()));
:
http://www.devdaily.com/java/edu/pj/pj010016/pj010016.shtml
Update:
:
package junk;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
public class Main{
private String scriptContent = '#!/bin/bash \n echo "yeah toast!" > /tmp/toast.txt';
public void doIt(){
try{
Writer output = new BufferedWriter(new FileWriter("/tmp/toast.sh"));
output.write(scriptContent);
output.close();
Runtime.getRuntime().exec("chmod u+x /tmp/toast.sh");
}catch (IOException ex){}
}
public static void main(String[] args){
Main m = new Main();
m.doIt();
}
}
Linux, /tmp/toast.sh , /tmp/toast.txt ", ". , Mac , BSD .