1 #!/bin/sh
   2 #
   3 #  Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   4 #  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5 #
   6 #  This code is free software; you can redistribute it and/or modify it
   7 #  under the terms of the GNU General Public License version 2 only, as
   8 #  published by the Free Software Foundation.
   9 #
  10 #  This code is distributed in the hope that it will be useful, but WITHOUT
  11 #  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12 #  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13 #  version 2 for more details (a copy is included in the LICENSE file that
  14 #  accompanied this code).
  15 #
  16 #  You should have received a copy of the GNU General Public License version
  17 #  2 along with this work; if not, write to the Free Software Foundation,
  18 #  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19 #
  20 #  Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21 #  or visit www.oracle.com if you need additional information or have any
  22 #  questions.
  23 #
  24 if [ "${TESTSRC}" = "" ]
  25 then
  26   echo "TESTSRC not set.  Test cannot execute.  Failed."
  27   exit 1
  28 fi
  29 echo "TESTSRC=${TESTSRC}"
  30 
  31 if [ "${TESTJAVA}" = "" ]
  32 then
  33   echo "TESTJAVA not set.  Test cannot execute.  Failed."
  34   exit 1
  35 fi
  36 echo "TESTJAVA=${TESTJAVA}"
  37 
  38 if [ "${TESTCLASSES}" = "" ]
  39 then
  40   echo "TESTCLASSES not set.  Test cannot execute.  Failed."
  41   exit 1
  42 fi
  43 
  44 JAVAC="${TESTJAVA}/bin/javac"
  45 JAR="${TESTJAVA}/bin/jar"
  46 
  47 rm -rf ${TESTCLASSES}/test3
  48 mkdir -p ${TESTCLASSES}/test3
  49 
  50 echo "Hello world" > ${TESTCLASSES}/test3/hello.txt
  51 echo "Bye world" > ${TESTCLASSES}/test3/bye.txt
  52 cp ${TESTSRC}/test1/com/foo/TestClass.java ${TESTCLASSES}/test3
  53 cd ${TESTCLASSES}/test3
  54 ${JAVAC} -d . TestClass.java
  55 
  56 ${JAR} cvf foo.jar hello.txt bye.txt com/foo/TestClass.class
  57 rm -f ../foo.jar
  58 mv foo.jar ..