#!/bin/bash if [ ! -d src ] then echo "Missing 'src/' directory. Creating one for you." echo "" mkdir src echo "Main-Class: MyPackage.MyClass" > src/Manifest.txt exit fi if [ ! -e src/Manifest.txt ] then echo "Missing 'src/Manifest.txt'. Creating one for you." echo "Remember updating the Main-Class value!" echo "" echo "Main-Class: MyPackage.MyClass" > src/Manifest.txt exit fi echo "Starting build process" echo "" echo " - Making sources.txt" if [ ! -d .tmp ] then mkdir .tmp fi find src -type f -name *.java > .tmp/sources.txt if [ -d bin ] then echo " - Clearing 'bin/'" rm -r bin fi echo " - Compiling into 'bin/'" mkdir bin javac -d bin -encoding UTF-8 @.tmp/sources.txt if [ -a application.jar ] then echo " - Deleting old jar" rm application.jar fi echo " - Creating new jar" cd bin jar cfm ../application.jar ../src/Manifest.txt * cd .. if [ -d res ] then echo " - Including resources" cd res jar uf ../application.jar * cd .. fi echo "" echo "Done." echo ""