#!/bin/sh
#
# FreeBSD-specific startup script for Eclipse Platform
#
# See: http://www.eclipse.org
#
# $FreeBSD: tags/RELEASE_8_4_0/java/eclipse/files/eclipse.in 300896 2012-07-14 13:54:48Z beat $
#
DEFAULT_JAVA_HOME=/usr/local/openjdk6
ECLIPSE_HOME=/usr/local/lib/eclipse
DEFAULT_JAVA_CMD=java
export GRE_HOME=/usr/local/lib/

#-----------------------------------------------------------------------------
# Determine configuration settings
#-----------------------------------------------------------------------------

# Determine the JDK home directory
if [ -z "${JAVA_HOME}" ]; then
	JAVA_HOME=${DEFAULT_JAVA_HOME}
fi

# Determine 'java' executable
if [ -z "${JAVACMD}" ]; then
	if [ -n "${JAVA_HOME}"  ]; then
		JAVACMD="${JAVA_HOME}/bin/java"
	else
		JAVACMD=${DEFAULT_JAVACMD}
	fi
fi

# Check if 'java' executable can be found
if [ ! -x "$JAVACMD" ]; then
	echo "Error: JAVA_HOME is not defined correctly: ${JAVA_HOME}"
	echo "       Unable to find ${JAVACMD}"
	exit 1
fi

# Check if 'eclipse' executable can be found
if [ ! -x "${ECLIPSE_HOME}/eclipse" ]; then
	echo "Error: ECLIPSE_HOME is not defined correctly: ${ECLIPSE_HOME}"
	echo "       Unable to find eclipse launcher binary"
	exit 1
fi

JAVA_VERSION="1.6" JAVA_OS="native" PATH=${JAVA_HOME}/bin:${PATH} exec "${ECLIPSE_HOME}/eclipse" $@
