123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- #!/bin/sh
- ###Licensed Materials - Property of IBM
- ###
- ###IBM Cognos Products: rspecupgrade
- ###
- ###(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*|CYGWIN*|MINGW*)
- sep=";"
- exeExt=".exe"
- if [ -z '../ibm-jre/jre' ]
- then
- ReportNetJRE=../ibm-jre/jre
- else
- ReportNetJRE=../jre
- fi
- # 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 JRE_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_OPTS=""
- if [ -z "$JRE_HOME" ]
- then
- if [ -z "$JAVA_HOME" ]
- then
- if [ -z "$ReportNetJRE" ]
- then
- echo
- else
- echo "Setting JRE_HOME to $ReportNetJRE"
- JRE_HOME="$ReportNetJRE"
- fi
- else
- echo "Setting JRE_HOME to value of JAVA_HOME: $JAVA_HOME"
- JRE_HOME="$JAVA_HOME"
- fi
- else
- echo "Using predefined JRE_HOME $JRE_HOME"
- fi
- if [ -z "$JRE_HOME" ]
- then
- echo "JRE_HOME is not defined. Please specify a valid JRE_HOME environment variable."
- exit 44
- fi
- echo "JRE_HOME=$JRE_HOME"
- JAVA_CMD="${JRE_HOME}/bin/java$exeExt"
- if [ -f "$JAVA_CMD" ]
- then
- echo "Using "$JAVA_CMD
- else
- echo "Cannot find $JAVA_CMD"
- exit 55
- fi
-
- CLASSPATH=".${sep}./jdxslt.jar${sep}./jaxen-1.1.1.jar${sep}${JRE_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}./log4j-over-slf4j-1.7.35.jar${sep}./slf4j-api-1.7.35.jar${sep}./icu4j.jar${sep}./dom4j-2.1.1.jar${sep}./jcam_crypto.jar${sep}./RSUpgrade.jar${sep}../webapps/p2pd/WEB-INF/lib/CognosCMPlugin.jar${sep}../webapps/p2pd/WEB-INF/lib/json4j.jar${sep}./jakarta-oro-2.0.8.jar${sep}./commons-lang-2.6.jar${sep}./commons-logging-1.1.jar${sep}./RSUpgradeTest.jar${sep}./i18nj.jar${sep}commons-httpclient-3.1.jar"
- # User defined classpath elements to add
- case $1 in
- -cp)
- shift
- CLASSPATH="$CLASSPATH${sep}${1}"
- shift
- ;;
- esac
- # 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
- # Determine the Threading Model
- # getconf will return either linuxthreads-<version> or NPTL <version> depending on the threading model.
- getconf GNU_LIBPTHREAD_VERSION 2>&1 | grep NPTL > /dev/null 2>&1
- if [ $? -eq 0 ] ; then
- hasNPTL=true
- else
- hasNPTL=false
- fi
- if [ ${hasNPTL} = true ] ; then
- #
- # Linux Distribution supporting NPTL (Native POSIX Threads Library)
- # IBM JRE versions 1.4.1 and earlier do not support NPTL; required to use LinuxThreads
- # by setting LD_ASSUME_KERNEL=2.4.19
- #
- IBM_JRE_VERSION=`${JAVA_CMD} -version 2>&1 | sed -n 's/.*\([0-9]\.[0-9]*\.[0-9]*\)[ ]*IBM.*/\1/p'`
- useLinuxThreads=false
- case ${IBM_JRE_VERSION:=0} in
- 1.4.*)
- IBM_JRE_REVISION=`echo ${IBM_JRE_VERSION} | sed -n 's/1\.[0-9]*\.\([0-9]*\)/\1/p'`
- if [ ${IBM_JRE_REVISION} -lt 2 ] ; then
- useLinuxThreads=true
- fi
- ;;
- 1.3.*)
- useLinuxThreads=true
- ;;
- esac
- if [ ${useLinuxThreads} = true ] ; then
- LD_ASSUME_KERNEL=2.4.19
- export LD_ASSUME_KERNEL
- fi
- fi
- ;;
- 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
- JAVA_OPTS="-Xmx512345678"
- ;;
- 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="$JRE_HOME/bin/java"
- export JAVA_CMD
- JAVA_OPTS="-classic"
- else if [ "$LANG" = "ja_JP.utf8" ]
- then
- JAVA_CMD="$JRE_HOME/bin/java"
- export JAVA_CMD
- JAVA_OPTS="-classic"
- fi
- fi
- JAVA_OPTS="$JAVA_OPTS -Xmx512345678"
- ;;
- OS/390)
- if [ "$LIBPATH" = "" ]
- then
- LIBPATH=.
- else
- LIBPATH=".:$LIBPATH"
- fi
- export LIBPATH
- IBM_JAVA_OPTIONS="-Dfile.encoding=ISO8859-1 -Xnoargsconversion"
- export IBM_JAVA_OPTIONS
- IBM_JAVA_ENABLE_ASCII_FILETAG="ON"
- export IBM_JAVA_ENABLE_ASCII_FILETAG
- ;;
- Windows*|CYGWIN*|MINGW*)
- ;;
- *)
- echo ""
- echo "Unexpected platform: $platform"
- echo ""
- ;;
- esac
- echo $*
- echo "$JAVA_CMD" ${JAVA_OPTS} -cp "$CLASSPATH" $*
- "$JAVA_CMD" ${JAVA_OPTS} -cp "$CLASSPATH" $*
- exit $?
|