#!/bin/sh # Licensed Materials - Property of IBM # IBM Cognos Products: ans # (C) Copyright IBM Corp. 2005, 2022 # US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. ################################################################### # Purpose # Set environment variables needed for Java and run a Java program. # # Arguments: # Parameters to the java command. # # Define the CLASSPATH separator character. # Would you believe that it is semicolon on Windows and colon on other platforms? sep=":" # Define exe extention for Windows executables exeExt="" # Define the path to the bundled JRE. ReportNetJRE="" platform="`uname -s`" case $platform in Windows*) sep=";" exeExt=".exe" ReportNetJRE=../ibm-jre/jre # Replace the back slashes with forward slashes in the first parameter. # Otherwise the substring operations used to extract the filename (see v5queries variable) do not work properly. cleanv4path=`tr '\\' '/' << THEPATH ${1} THEPATH ` ;; esac # Option to be used with JAVA_CMD when executing programs. # Can not be part of JAVA_CMD since JAVA_HOME can have spaces # and JAVA_CMD must be one "word" if it is to be quoted. # # Use of the variable must not be in quotes otherwise an empty # string will be passed to java as a parameter. # # Value is either an empty string or "-classic" JAVA_CLASSIC="" if [ -z "$JAVA_HOME" ] then echo "Setting JAVA_HOME to $ReportNetJRE" JAVA_HOME="$ReportNetJRE" else echo "Using predefined JAVA_HOME $JAVA_HOME" fi if [ -z "$JAVA_HOME" ] then echo "JAVA_HOME is not defined. Please specify a valid JAVA_HOME environment variable." exit 44 fi echo "JAVA_HOME=$JAVA_HOME" JAVA_CMD="${JAVA_HOME}/bin/java$exeExt" if [ -f "$JAVA_CMD" ] then echo "Using "$JAVA_CMD else echo "Cannot find $JAVA_CMD" exit 55 fi UPGRADE_LIB_DIR="../webapps/p2pd/WEB-INF/lib" CLASSPATH="./jdxslt.jar${sep}${JAVA_HOME}/lib/rt.jar${sep}./qfwV4toV5J.jar${sep}./cclcfgapi.jar${sep}./CognosIPF.jar${sep}./cclcoreutil.jar${sep}./log4j-api-2.17.1.jar${sep}./log4j-core-2.17.1.jar${sep}./dom4j-2.1.1.jar${sep}${UPGRADE_LIB_DIR}/CognosCMPlugin.jar${sep}${UPGRADE_LIB_DIR}/CognosCM.jar" echo "CLASSPATH=${CLASSPATH}" # The following case statement was copied from crconfig.sh # It would be better to have a single script that we all use to invoke Java. # I will propose this to the Java working group. case $platform in Linux) if [ -z "$LD_LIBRARY_PATH" ] then LD_LIBRARY_PATH=. else LD_LIBRARY_PATH=".:$LD_LIBRARY_PATH" fi export LD_LIBRARY_PATH ;; SunOS) if [ -z "$LD_LIBRARY_PATH" ] then LD_LIBRARY_PATH=. else LD_LIBRARY_PATH=".:$LD_LIBRARY_PATH" fi export LD_LIBRARY_PATH ;; AIX) if [ -z "$LIBPATH" ] then LIBPATH=. else LIBPATH=".:$LIBPATH" fi export LIBPATH ;; HP-UX) if [ -z "$SHLIB_PATH" ] then SHLIB_PATH=. else SHLIB_PATH=".:$SHLIB_PATH" fi export SHLIB_PATH if [ "$LC_CTYPE" = "ja_JP.utf8" ] then JAVA_CMD="$JAVA_HOME/bin/java" export JAVA_CMD JAVA_CLASSIC="-classic" else if [ "$LANG" = "ja_JP.utf8" ] then JAVA_CMD="$JAVA_HOME/bin/java" export JAVA_CMD JAVA_CLASSIC="-classic" fi fi ;; Windows*) ;; *) echo "" echo "Unexpected platform: $platform" echo "" ;; esac echo "$JAVA_CMD" ${JAVA_CLASSIC} -cp "$CLASSPATH" com.cognos.cm.plugin.ans.ANSUpgrade $* "$JAVA_CMD" ${JAVA_CLASSIC} -cp "$CLASSPATH" com.cognos.cm.plugin.ans.ANSUpgrade $* exit $?