Skip to content

Instantly share code, notes, and snippets.

@agronholm
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agronholm/48d5eda810588dfed2db to your computer and use it in GitHub Desktop.
Save agronholm/48d5eda810588dfed2db to your computer and use it in GitHub Desktop.
Jython standalone -> Java Web Start jar converter
#!/bin/sh
set -e
# Converts a Jython standalone jar into something usable with Java Web Start
if [ -z $1 ]; then
echo "Please give the path to the standalone jar as the first argument."
exit 1
fi
CURRDIR=$(pwd)
JAR_PATH="$1"
CONVERTED_JAR_PATH="$CURRDIR/jython-webstart.jar"
TEMPDIR=$(mktemp -d)
cd "$TEMPDIR"
jar xf "$JAR_PATH"
rm -rf Lib/test # including Jython's own unit tests is pointless
java -jar "$JAR_PATH" -m compileall Lib
find Lib -name "*.py" -delete
mv Lib/* .
rmdir Lib
jar cfm "$CONVERTED_JAR_PATH" META-INF/MANIFEST.MF *
rm -rf "$TEMPDIR"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment