1 #!/bin.bash 2 cat >/dev/null<<LICENSE 3 /* 4 * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. 5 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 * 7 * This code is free software; you can redistribute it and/or modify it 8 * under the terms of the GNU General Public License version 2 only, as 9 * published by the Free Software Foundation. Oracle designates this 10 * particular file as subject to the "Classpath" exception as provided 11 * by Oracle in the LICENSE file that accompanied this code. 12 * 13 * This code is distributed in the hope that it will be useful, but WITHOUT 14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16 * version 2 for more details (a copy is included in the LICENSE file that 17 * accompanied this code). 18 * 19 * You should have received a copy of the GNU General Public License version 20 * 2 along with this work; if not, write to the Free Software Foundation, 21 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 22 * 23 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 24 * or visit www.oracle.com if you need additional information or have any 25 * questions. 26 */ 27 LICENSE 28 29 OS=$(uname -s ) 30 if [[ "$OS" == Linux ]]; then 31 export ostype=linux 32 elif [[ "$OS" == Darwin ]]; then 33 export ostype=macosx 34 else 35 echo "could not determine ostype uname -s returned ${OS}" 36 exit 1 37 fi 38 39 ARCH=$(uname -m) 40 if [[ "$ARCH" == x86_64 ]]; then 41 export archtype=${ARCH} 42 elif [[ "$ARCH" == arm64 ]]; then 43 export archtype=aarch64 44 else 45 echo "could not determine aarchtype uname -m returned ${ARCH}" 46 exit 1 47 fi 48 49 export JAVA_HOME=${PWD}/../build/${ostype}-${archtype}-server-release/jdk 50 echo "exporting JAVA_HOME=${JAVA_HOME}" 51 if echo ${PATH} | grep ${JAVA_HOME} >/dev/null ;then 52 echo 'path already contains ${JAVA_HOME}/bin' 53 else 54 export SAFE_PATH=${PATH} 55 echo 'adding ${JAVA_HOME}/bin prefix to PATH, SAFE_PATH contains previous value' 56 export PATH=${JAVA_HOME}/bin:${PATH} 57 fi