QShell Jar Command Problem on IBM i

On site Easy400.net I distribute a number of utilities (ZIPSAVE, EZPACK) that use the QShell " jar " command to compress save files.
(The " jar " command is a java general-purpose archiving and compression tool, based on ZIP and the ZLIB compression format)

My utilities had no problems on V5R2 through V6R1.

However, after installing these utilities on a V7R2 box, all of the sudden the "jar" command was failing to be executed in the QShell environment.
The QShell command entry screen was displaying the following:

The java.version property was detected as input. This property is used as output only and has no effect on JVM initialization.
qsh: 001-0078 Process ended by signal 5.
Press ENTER to end terminal session.

It took me quite a while to find out that, in this case, the environment variable JAVA_HOME was set to directory
/qibm/ProdData/Java400/jdk6
which dit not even exist. That could explain why the Java Virtual Machine (JVM) was not able to start.

I then decided to have a look at the JDK option installed on the system. I used command DSPSFWRSC for that. I found that the following had been installed:

Resource                              
   ID     Option  Feature  Description
5770JV1   11       5111    Java SE 6 32 bit (IBM Technology for Java 6 32-bit)
5770JV1   12       5112    Java SE 6 64 bit (IBM Technology for Java 6 64-bit)
5770JV1   14       5114    Java SE 7 32 bit (IBM Technology for Java 7 32-bit)
5770JV1   15       5115    Java SE 7 64 bit (IBM Technology for Java 7 64-bit)

Each of the options has its own IFS directory, as follow (see this IBM Knowledge Center page)

/QOpenSys/QIBM/ProdData/JavaVM/jdk60/32bit
/QOpenSys/QIBM/ProdData/JavaVM/jdk60/64bit
/QOpenSys/QIBM/ProdData/JavaVM/jdk70/32bit
/QOpenSys/QIBM/ProdData/JavaVM/jdk70/64bit

My guess was that, if I could properly change the JAVA_HOME page for QShell, the Jar command would start working again.

My first trial was to run command
CHGENVVAR ENVVAR('JAVA_HOME') VALUE('/QOpenSys/QIBM/ProdData/JavaVM/jdk70/32bit') LEVEL(*JOB)
but that did not work (possibly because the Jar command was executing in a *NEW activity group).

Next I tried command
CHGENVVAR ENVVAR('JAVA_HOME') VALUE('/QOpenSys/QIBM/ProdData/JavaVM/jdk70/32bit') LEVEL(*SYS)
and that DID IT.

This "system level" environment variable applies to every job or thread and has no need to be repeated.

Giovanni B. Perotti
September 15, 2015