Ижевский ГТУ, МГУ, Петрозаводский ГУ и проект SnarkNews представляют

Зеркало Petrozavodsk Winter - 2013.

 

Используемая на сервере реализация Java version 7 - Java 1.7.0_03

Компиляция программ на Java осуществляется следующим скриптом:


prefix="/home/ejudge/system"
exec_prefix="/home/ejudge/system"
libexecdir="/home/ejudge/system/libexec"

LANG_CONFIG_DIR="/home/ejudge/contests/compile/conf/lang.d"
[ "${EJUDGE_LANG_CONFIG}" = "" ] && EJUDGE_LANG_CONFIG="${LANG_CONFIG_DIR}/javac7.cfg"

infile="$1"
outfile="$2"

if [ -f "${EJUDGE_LANG_CONFIG}" ]
then
  . "${EJUDGE_LANG_CONFIG}"
else
  version="unknown"
  JAVARUN="/usr/bin/java7"
  JAVACRUN="/usr/bin/javac7"
  JAVADIR="/usr"
  JAVAVER="1.7"
fi

if [ x"${version}" = x ]
then
  echo "This language is not supported." >&2
  exit 1
fi

# avoid setting JAVA_HOME if it is already set
# actually, setting of JAVA_HOME breaks some systems, so don't do it
MY_JAVA_HOME="${JAVA_HOME}"
if [ "${MY_JAVA_HOME}" = "" ]
then
    MY_JAVA_HOME="${JAVADIR}"
    PATH="${MY_JAVA_HOME}/bin:${PATH}"
    export PATH
fi

rm -f *.class
exec "${libexecdir}/ejudge/lang/ej-javac" "${infile}" "${outfile}" "${JAVACRUN}" "${JAVAVER}" "${MY_JAVA_HOME}"

Запуск программ на Java 7 осуществляется следующим скриптом:

runfile="$1"

LANG_CONFIG_DIR="/home/ejudge/contests/compile/conf/lang.d"
[ "${EJUDGE_LANG_CONFIG}" = "" ] && EJUDGE_LANG_CONFIG="${LANG_CONFIG_DIR}/javac7.cfg"

if [ -f "${EJUDGE_LANG_CONFIG}" ]
then
  . "${EJUDGE_LANG_CONFIG}"
else
  JAVARUN="/usr/bin/java7"
  JAVADIR="/usr"
  JAVAVER="1.7"
fi

# avoid setting JAVA_HOME if it is already set
#if [ "${JAVA_HOME}" = "" ]
#then
#    JAVA_HOME="${JAVADIR}"
#    PATH="${JAVA_HOME}/bin:${PATH}"
#    export JAVA_HOME PATH
#fi

if [ x"${EJUDGE_JAVA_POLICY}" = xnone ]
then
  # no security policy, use with caution!
  mv "$1" Main.jar || exit 128
  exec "${JAVARUN}" ${EJUDGE_JAVA_FLAGS} -jar ./Main.jar
fi

[ x"${EJUDGE_JAVA_POLICY}" = x ] && EJUDGE_JAVA_POLICY=default.policy

if [ -f "${EJUDGE_JAVA_POLICY}" ]
then
  policy_file="${EJUDGE_JAVA_POLICY}"
else
  if [ x"${EJUDGE_PREFIX_DIR}" = x ]
  then
    echo "EJUDGE_PREFIX_DIR is not set - impossible to set security policy" >&2
    exit 128
  fi
  policy_file="${EJUDGE_PREFIX_DIR}/share/ejudge/${EJUDGE_JAVA_POLICY}"
fi

if [ ! -f "${policy_file}" ]
then
  echo "Java policy file does not exist" >&2
  exit 128
fi

mv "$1" Main.jar || exit 128
exec "${JAVARUN}" ${EJUDGE_JAVA_FLAGS} -Duser_language=us -Duser_country=us -Duser_variant=us -Djava.security.manager -Djava.security.policy="${policy_file}" -jar ./Main.jar