#!/usr/bin/bash
. /usr/share/java-utils/java-functions

MAIN_CLASS=panoramajoinner.PanoramaMaker

set_classpath "swing-layout"
set_classpath "jpanoramamaker-5.6"

mem=`free -mt | tail -n1 | sed 's/  */ /g' | cut -d ' ' -f 2`;
let "mem=$mem/3*2"
r=`let "mem=$mem/3*2" 2>&1`; 
echo $mem
echo "$r" | r=`sed 's/  */ /g'`
echo $r

if [ "$r" = "" ] ; then 
  FLAGS=$FLAGS" -Xmx$mem""M"
  echo "executing with -Xmx$mem""M"
  run ${@}
else
  echo "executing without -Xmx!"
  run ${@}
fi
