I have a plain java app that has a main class that calls shell script files under src/main/resources/*.sh
I am using Runtime.getRuntime().exec(cmd) to execute the script.
String cmdPath = new this.getClass().getResource("/XXXX.sh").getPath()
String[] cmd = { "bash", cmdPath };
I am getting exit code 127.
1)Running using java -jar xxx.jar
2)File permissions for the sh file is -rw-rw-r--
How can I get the file permission of script file to execute ?
script files are under src/main/resource/
Used maven-jar plugin to bundle the jar and the script files came into root directory
jar /-com -software -cmd.sh
Tried maven assembly plugin with custom script to grant 755 permissions to all files under {basedir} (which is not defined anywhere). It did not work
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
<id>ourAssembly</id>
<formats>
<format>jar</format>
</formats>
<fileSets>
<fileSet>
<directory>${basedir}</directory>
<includes>
<include>**/*</include>
</includes>
<fileMode>0755</fileMode>
</fileSet>
</fileSets>