#!/bin/sh
# USAGE: exjar Name-of-jar-file Name-of-main-class
# This little script takes a standard jar file and makes it
# executable.  For example, suppose you had a jar file named
# j.jar that had a class JJ that you wanted to make the default
# main class of the jar.  Then you would execute
# ./exjar.sh j.jar JJ
# this would create a new jar file named JJ_JJ.jar on which you
# could enter a command like
#    java -jar JJ_JJ.jar [arg1 ...]
# which would result in running the class JJ with the provided args
# On some windowing systems clicking on JJ_JJ.jar will start the class 
# JJ with no arguements 
mkdir tmp
cd tmp
jar fvx ../$1 
echo "Created-By: Geoff
Main-Class: $2

" > themani
rm -rf META-INF
jar fcm $2_$2.jar themani *
mv $2_$2.jar ..
cd ..
rm -rf tmp

