#!/bin/sh

if [ -n "$JAVA_HOME"  ] ; then
   if [ -x "$JAVA_HOME/bin/java" ] ; then
       JAVACMD="$JAVA_HOME/bin/java"
   else
       echo "** ERROR: java under JAVA_HOME=$JAVA_HOME cannot be executed"
       exit 1
   fi
else
   JAVACMD=`which java 2> /dev/null `
   if [ -z "$JAVACMD" ] ; then
       JAVACMD=java
   fi
fi

CLI_DIR=`dirname $0`
LIB_DIR=$CLI_DIR/../clilib
CLASSPATH=.

for i in `ls $LIB_DIR/*.jar`
do
  CLASSPATH="$CLASSPATH:$i"
done

exec "$JAVACMD" $JAVA_OPTIONS -classpath $CLASSPATH org.artifactory.cli.main.ArtAdmin "$@"
