So I am trying to write an .sh file that will be executable, this is how I'm currently writing it:

```
Writer output = null;

try {
  output = new BufferedWriter(new FileWriter(file2));
  output.write(shellScriptContent);
  output.close();
} catch (IOException ex) {
  Logger.getLogger(PunchGUI.class.getName()).log(Level.SEVERE, null, ex);
}

```

So that writes the file just fine, but it is not executable. Is there a way to change the executable status when I write it?

Edit: To further clarify, I am trying to make it execute by default, so that for instance, if you double clicked the generated file, it would automatically execute.