How do I point my installed isCOBOL to a different Java location?
Estimated Reading Time: 2 Minutes
When you install isCOBOL, it asks you for the location of the Java installation, and saves this path in a file or files. Then all the executable wrappers installed in the %isCOBOL%/bin folder look for this file to find Java.
If you install a new version or type of Java (OracleJDK to OpenJDK, for instance), you just need to change the path saved in this file to redirect all of the wrappers to the new Java. The path should be changed in two places, one for the compiler and one for the runtime.
This file is named and located in different place in the Windows and UNIX/Linux installations:
Windows
The compiler uses a batch file to set the JDK path. Open %ISCOBOL%\bin\isshell.bat in a text editor, and change the value of ISCOBOL_JDK_ROOT and ISCOBOL_JRE_ROOT to your new Java installation.
For example, in C:\Veryant\isCOBOL_SDK2022R2\bin\isshell.bat, change these two lines:
set ISCOBOL_JDK_ROOT=C:\Program Files\Java\OpenJ9_80.232.09 set ISCOBOL_JRE_ROOT=C:\Program Files\Java\OpenJ9_80.232.09
The Runtime and other products and utilities use a file called pref_jre.cfg.
Change the java path in the "pref_jre.cfg" file (%ISCOBOL%\.install4j\pref_jre.cfg).
For example, in C:\Veryant\isCOBOL2020R1\.install4j\pref_jre.cfg, change the existing line
C:\Program Files\Java\jdk1.8.0_241To
C:\Program Files\Java\OpenJ9_80.232.09UNIX/Linux
Change the java path in the "default_java.conf" file ($ISCOBOL/bin/default_java.conf).
For example, in /opt/isCOBOL2020R1/bin, open default_java.conf with vi, and change these lines:
ISCOBOL_JDK_ROOT=/opt/jdk8u242-b08 ISCOBOL_JRE_ROOT=/opt/jdk8u242-b08To
ISCOBOL_JDK_ROOT=/usr/lib/jvm/java-8-openjdk-amd64 ISCOBOL_JRE_ROOT=/usr/lib/jvm/java-8-openjdk-amd64