Created
October 17, 2021 09:45
-
-
Save xranby/e7549d016fc6365e021ce99b5bfb2911 to your computer and use it in GitHub Desktop.
unpacked jar java example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# assume you have a java application named update/*.jar that is using jars in update/lib/.jar | |
# this script will unpack all jars into the run folder | |
# then start your application inside the run folder with very simple classpath options | |
sdir=`dirname $(readlink -f $0)` | |
rootdir=`dirname $sdir` | |
echo rootdir $rootdir | |
# Remove the old run dir, recreate it | |
rm -rf $rootdir/run > /dev/null | |
mkdir -p $rootdir/run | |
cd $rootdir/run | |
# Unpack all jars into run | |
for z in $rootdir/update/*.jar; do echo $z ; unzip -oq $z; done | |
for z in $rootdir/update/lib/*.jar; do | |
# do not override update/*.jar with update/lib/*jar content | |
if [ ! -e $rootdir/update/`basename $z` ] ; then | |
echo $z ; unzip -oq $z | |
else | |
echo `basename $z` " duplicate in update and update/lib" | |
fi | |
done | |
# Run your main class | |
java -Djava.library.path=. -classpath . mainClass | |
cd $rootdir |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment