@echo off rem Licensed Materials - Property of IBM rem rem IBM Cognos Products: cnfg rem rem (C) Copyright IBM Corp. 2005, 2022 rem rem US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. rem --------------------------------------------------------------------------- rem Shell script (Windows) to invoke jre and launch IBM Cognos Configuration. rem rem J_HOME is the location of the Java RE installation; if JAVA_HOME is rem defined, use it. Otherwise default to the local distribution. rem J_OPTS are the Java options to be passed into the JAVA VM (optional) rem --------------------------------------------------------------------------- rem rem The argument -java:{env | local} is not supported start from CA R2 11.1.2 rem rem If the argument -java:{env | local} is present as first argument then the required JRE will be rem loaded: -java:env will force the script to look for JRE using JAVA_HOME environment variable. rem If not found then it will end by an error. The argument -java:local will force it to look rem for JRE within the local distribution. If not found then it will end by an error. rem Otherwise, the script will default by looking for a JRE using the JAVA_HOME environment rem variable, then if cannot find one, it will try to use the local distribution. rem Causes all changes made to environment variables to be local to this script rem up to the point where endlocal is encountered. setlocal rem Change directories to where this script lives CD /d %~dp0 rem ----- Verify and Set Required Environment Variables ----------------------- rem check if we need to run the local jre rem Shift the first argument: -java:local if "%1" == "-java:local" (shift & echo Option -java:local is not supported. Ignore it.) rem Try first the use of JAVA_HOME goto useEnvVar :useEnvVarOnly rem JAVA_HOME should be defined first. if "%JAVA_HOME%" == "" goto JavaHomeError set J_HOME=%JAVA_HOME% echo Looking for JRE in: %J_HOME%\bin... if exist "%J_HOME%\bin\java.exe" goto gotJava set J_HOME=%JAVA_HOME%\jre echo Looking for JRE in: %J_HOME%\jre\bin... if exist "%J_HOME%\bin\java.exe" goto gotJava :JavaHomeError echo You have specified the argument '-java:env'. echo However, the environment variable JAVA_HOME is not defined or incorrectly defined. echo Please define JAVA_HOME first before using the argument '-java:env'. goto finish rem Did not find a JRE in the local location, display error and exit. goto error :useEnvVar rem Shift the first argument: -java:env if "%1" == "-java:env" (shift & echo Option -java:env is not supported. Ignore it.) rem Using the distribution referred by JAVA_HOME because rem -java:local was NOT specified and the JAVA_HOME environment rem variable is defined. if "%JAVA_HOME%" == "" ( set J_HOME=. ) else ( set J_HOME=%JAVA_HOME% ) echo Looking for JRE in: %J_HOME%\bin... if exist "%J_HOME%\bin\java.exe" goto gotJava if "%JAVA_HOME%" == "" ( set J_HOME=..\ibm-jre\jre ) else ( set J_HOME=%JAVA_HOME%\jre ) echo Looking for JRE in: %J_HOME%\bin... if exist "%J_HOME%\bin\java.exe" goto gotJava rem Did not find a JRE in the environment variable's location. :error echo Could not find a JRE. Cannot run IBM Cognos Configuration. goto finish :gotJava rem ----- Prepare Appropriate Java Execution Commands ------------------------- set _RUNJAVA="%J_HOME%\bin\java" set J_OPTS="-Dcom.ibm.jsse2.overrideDefaultTLS=true" %J_OPTS% rem ----- Enabling network preference. ---------------------------------------------- rem The next command checks if IPv4 or IPv6 will be configured. rem Since network configuration is only checked at JVM initialization time, it must be done here if "%1" == "-ipv4" (shift & goto configureIPv4) if "%1" == "-IPv4" (shift & goto configureIPv4) if "%1" == "-ipv6" (shift & goto configureIPv6) if "%1" == "-IPv6" (shift & goto configureIPv6) goto ddraw :configureIPv4 set J_OPTS="-Djava.net.preferIPv4Stack=true" %J_OPTS% goto ddraw :configureIPv6 set J_OPTS="-Djava.net.preferIPv6Addresses=true" %J_OPTS% goto ddraw :ddraw rem uncomment to run Cognos Configuration with debug settings, so can attach a debugger rem set DEBUG_OPTS=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=9091,server=y,suspend=y -Djava.compiler=NONE rem ----- Disabling DirectDraw. ---------------------------------------------- rem The next command checks if the DirectDraw will be disabled. rem Disabling this DirectDraw might reduce the performance of the program that renders the image. rem It is recommended to disable the DirectDraw in the case the ConfigTool and some desktop rem icons flicker/flashes when started. if "%1" == "-noddraw" set DD_OPTS=-Dsun.java2d.noddraw=true if "%1" == "-noDDraw" set DD_OPTS=-Dsun.java2d.noddraw=true if not "%DD_OPTS%" == "" echo Disabling DirectDraw... set J_OPTS=%DD_OPTS% %J_OPTS% %DEBUG_OPTS% rem ----- Set Up The Runtime Classpath ---------------------------------------- set CP=.;..\bin\cclcfgmcf_mcf.jar;cogconfig.jar;configcnfm.jar;..\bin\cogconfigi.jar;..\bin\cogcnfm.jar;..\bin\bcprov.jar;..\bin\bcpkix.jar;..\bin\dom4j-2.1.1.jar;..\bin\jaxen-1.1.1.jar;..\bin\cclcfgmcf.jar;..\bin\cclcfgapi.jar;..\bin\jcam_crypto.jar;..\bin\i18nj.jar;..\bin\icu4j.jar;..\bin\commons-httpclient-3.1.jar;..\bin\commons-codec-1.15.jar;..\bin\commons-logging-1.1.jar;..\bin\commons-logging-api-1.1.jar;..\bin\commons-logging-adapters-1.1.jar;..\bin\CognosIPF.jar;..\bin\slf4j-nop-1.7.23.jar;..\bin\log4j-api-2.17.1.jar;..\bin\log4j-core-2.17.1.jar;..\bin\log4j-over-slf4j-1.7.35.jar;..\bin\jcam_jni.jar;..\bin\jdxslt.jar;..\bin\jcam_config_test.jar;..\bin\cclcoreutil.jar;..\bin\CognosCCL4J.jar;..\configuration\utilities\config-util.jar @echo Using CLASSPATH: %CP% @echo Using J_HOME: %J_HOME% @echo Using J_OPTS: %J_OPTS% rem ----- Execute The Requested Command --------------------------------------- %_RUNJAVA% -cp %CP% %J_OPTS% CRConfig %1 %2 %3 %4 %5 %6 %7 %8 %9 exit /b %ERRORLEVEL% :finish endlocal rem exit with error code 2: java home error exit /b 2