Writing a bash script from java

I have a Java program that writes a bash script. Unfortunately, when this script is saved, I need to change it (ubuntu 10.04) to include it as an executable. Any way around this?

I understand that this is a safety thing ...

+3
source share
2 answers

If you are not using JDK 1.6, you can do the following:

After writing the file, you can do something like

Runtime.getRuntime().exec("chmod +x "+yourfile.sh);
+2
source

Source: https://habr.com/ru/post/1756205/


All Articles