#!/bin/sh

if [ "x$JAVA_HOME" = "x" ]; then
	echo " Error: please set JAVA_HOME environment first!"
	exit 1;
fi

# cygwin compatiable
cygwin=false;
case "`uname`" in  CYGWIN*)
  cygwin=true ;
esac

MAIN_CLASS=org.jfox.framework.Startup

HOTSPOT=`java -version 2>&1 | grep HotSpot`"x"
if [ "$HOTSPOT" != "x" ]; then
       HOTSPOT="-server"
else
       HOTSPOT=""
fi

JFOX_CLASSPATH=../conf:../framework/classes:../framework/lib/log4j-1.2.8.jar
if $cygwin; then
  JFOX_CLASSPATH=`cygpath --path --windows "$JFOX_CLASSPATH"`
fi

if $cygwin; then
  JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi


JFOX_MEMORY_OPTS="-Xms128m -Xmx512m"

JFOX_GC_OPTS=""

echo "======================================="
echo "  JFox Application Server Version 2"
echo "  JAVA_HOME: $JAVA_HOME"
echo "  Memory Options: $JFOX_MEMORY_OPTS"
echo "  GC Options: $JFOX_GC_OPTS"
echo "======================================="

$JAVA_HOME/bin/java $HOTSPOT $JFOX_MEMORY_OPTS -classpath $JFOX_CLASSPATH $MAIN_CLASS
