#!/usr/bin/env bash # # On rpm, you'll need: # # * java-devel # * javapackages-tools # * ecj # dirs=(bin lib src) name="weka-clustering.jar" weka_version="3.8.6" weka_version_hyphen="3-8-6" [[ -f $name ]] && mv "$name" "$name.bk" [[ -d src ]] || (echo "This script requires the input java files in src"; exit) rm -rf bin for d in "${dirs[@]}"; do [[ -d $d ]] || mkdir "$d" done # Download and extract weka.jar to the lib dir wget -qO temp.zip "https://sourceforge.net/projects/weka/files/weka-${weka_version_hyphen%-*}/$weka_version/weka-$weka_version_hyphen.zip/download" && unzip -o -j temp.zip weka-$weka_version_hyphen/weka.jar -d lib && rm temp.zip javac -cp lib/*.jar -d bin src/*.java # Build the classes from source java # ecj -17 -classpath lib/weka.jar -d bin src && # Add weka classes to the bin unzip -o lib/weka.jar -d bin && # Create the jar file from the classes jar cvf "$name" -C bin .