There isn't an "auto-extract = true" feature built into the JAR standard. You'll have to roll your own solution.
You have several different options:
1) JAR files are basically zip archives. So, outsiders can access the scripts by reading the JAR as a zip. You can ship a bash script with your application that uses unzip
to extract the script from your file.
2) In Maven, you can the Dependency plugin's dependency:unpack goal to extract the scripts from the jar so they can be placed into a more suitable location in your distribution assembly. So use something like this (below is untested):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.5.1</version>
<executions>
<execution>
<id>unpack</id>
<phase>package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.augustl</groupId>
<artifactId>scripts</artifactId>
<version>1.0.0</version>
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/scripts</outputDirectory>
<includes>**/*.py</includes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
3) In your application, you can read the script as an InputStream
and write it to a temporary file for execution. As long as your script has a fairly unique name, this is fairly straight-forward using Class.getResourceAsStream(String name)
See also: