iSeries home   |   Easy400     |   CGIDEV2     |   MMAIL  
Program development
TABLEXLS includexml
Right to left
Scott's demos
Java products
Questions & Answers


Programmers used to work with library lists may have some problems in understanding how the JVM (Java Virtual Machine) works in retrieving Java "programs".
The following may help in understanding what goes on and how a developer can master it.

  1. About JAR files
    1. Java code resides in Java classes. Stream files with extension JAR are collections of Java classes. In other words, a JAR file can be understood as a library of programs.
    2. IFS directory /QIBM/userdata/java400/ext may contain several Java classes. These Java classes make up something like a Default Library List for Java classes.
    3. The CLASSPATH environment variable is a list of JAR files. It can therefore be understood as a Library List for Java classes.
    4. The environment variable CLASSPATH is mandatory when some of the Java code to be executed is in a directory other than /QIBM/userdata/java400/ext and must be set before that the JVM is started. Once started, the JVM cannot be restarted.

  2. JAR files in HSSFCGI and XLPARSE2
    • HSSFCGI jar files are in subdirectories of IFS directory /HSSFCGI/java
    • XLPARSE2 jar files are in subdirectories of IFS directory /XLPARSE2/java
    • HSSFCGI2 and XLPARSE2 jar files are the same
    • HSSFCGI and XLSPARSE2 programs calling Java classes use each a separate CLASSPATH string, mentioning their jar files. However, as the jar files are the same for both the utilities, there two CLASSPATHs are interchangeable.
    • Both HSSFCGI and XLPARSE2 feature a command, SETDFTJARS, that copies their jar files (identical for both the tools) to IFS directory /QIBM/userdata/java400/ext. This could be of some help when CLASSPATHs look like having problems. Both Both HSSFCGI and XLPARSE2 feature another command, RMVDFTJARS, that removes thier jar files from IFS directory /QIBM/userdata/java400/ext.

  3. Jobs running multiple Java products
    1. Jobs running both HSSFCGI programs and XLPARSE2 programs have no JVM problems.
    2. Jobs running other Java products plus HSSFCGI and/or XLPARSE2 may have JVM troubles.
      Such troubles may by solved by running command HSSFCGI/JVMSTARTUP or XLPARSE2/JVMSTARTUP as soon as a job is started or before executing any application using the JVM.
      This command sets up the JVM environment for HSSFCGI and XLPARSE2 and optionally extends the classpath through a string provided in a parameter of this command.
      This makes sure that HSSFCGI and XLPARSE2 java code can run, whatever other mix of java programs is going to be executed.

  4. In case of unsolved JVM problems
    If a mix of HSSFCGI/XLPARSE2 and other Java products fails to run within a single job, the only way out is to submit to a batch job the execution of HSSFCGI or XLPARSE2 commands.
    • XLPARSE2 commands feature a SBMJOB parameter. That parameter allows to submit a command for execution in a separate batch job. The submitted job is synchronized with the submitting job: that is, the submittiong job resumes execution after completion of the submitted job.
    • Also HSSFCGI commands feature a SBMJOB parameter. However in this case the submitted job is not synchronized with the submitting one.