Change Java Program (CHGJVAPGM)

Where allowed to run: All environments (*ALL)
Threadsafe: No
Parameters
Examples
Error messages

The Change Java Program (CHGJVAPGM) command changes attributes of Java programs(s) which are attached to Java class, ZIP, or JAR files. The command also recreates Java programs so that they are up to date with the current level of the operating system.

The CHGJVAPGM replaces existing Java programs only. Because of implicit creation of Java programs during run time, it is possible that only some classes in a ZIP or JAR file are represented in Java programs. This command will only change programs that already exist. The CRTJVAPGM command can be used to create programs for all classes in a ZIP or JAR file.

Restrictions: The file must be in one of the following file systems: QOpenSys, "root", or a user-defined file system.

Top

Parameters

Keyword Description Choices Notes
CLSF Class file or JAR file Path name Required, Positional 1
OPTIMIZE Optimization 10, *INTERPRET, 20, 30, 40, *SAME Optional
ENBPFRCOL Enable performance collection *NONE, *ENTRYEXIT, *FULL, *SAME Optional
PRFDTA Profiling data *SAME, *NOCOL, *COL, *CLR, *APY Optional
MERGE Merge *YES, *RPL Optional
SUBTREE Directory subtree *NONE, *ALL Optional
LICOPT Licensed Internal Code options Character value, *OPTIMIZE, *SAME Optional
Top

Class file or JAR file (CLSF)

Specifies the class file, JAR file, or ZIP file name from which to change the Java program. The file name may be qualified by one or more directory names.

class-file-name
Specify the name of the class file or a pattern for identifying the class file or files to be used. A pattern can be specified in the last part of the name. An asterisk matches any number of characters and a question mark matches a single character. If the name is qualified or contains a pattern it must be enclosed in apostrophes. An example of a qualified class file name is '/directory1/directory2/myclassname.class'. An example of a pattern is '/directory1/directory2/myclass*.class'.
JAR-file-name
Specify the name of the Java archive (JAR) file or pattern for identifying the JAR or ZIP file or files to be used. A file is assumed to be a JAR file if the file name ends with '.jar' or '.zip'. A pattern can be specified in the last part of the name. An asterisk matches any number of characters and a question mark matches a single character. If the name is qualified or contains a pattern it must be enclosed in apostrophes. An example of a qualified JAR file name is '/directory1/directory2/myappname.jar'. An example of a pattern is '/directory1/directory2/myapp*.zip'.
Top

Optimization (OPTIMIZE)

Specifies the optimization level of the Java program.

As of Version 6 Release 1 Modification 0 of the operating system, the value of this parameter is ignored and OPTIMIZE(*INTERPRET) is used.

In V6R1M0 and following releases, Java programs do not contain machine instructions. Java programs contain a pre-verified internal form of one or more Java classes. At runtime, a Java program is either interpreted from the bytecodes or else run with the Just In Time compiler (JIT).

For Java programs created for a target release prior to V6R1M0, the OPTIMIZE parameter may be used to change the encapsulated optimization level of the Java program. The encapsulated value of the OPTIMIZE parameter is used during Java program retranslation on the target release of the operating system.

*SAME
The program optimization attribute does not change.
10
The Java program contains a compiled version of the class bytecodes but has only minimal additional compiler optimization. Variables can be displayed and modified while debugging.
*INTERPRET
The Java program created does not contain machine specific instructions. The Java program is interpreted from the bytecodes or run with the JIT compiler when it is started. Variables can be displayed and modified while debugging.
20
The Java program contains a compiled version of the class bytecodes and has some additional compiler optimization. Variables can be displayed but not modified while debugging.
30
The Java program contains a compiled version of the class bytecodes and has more compiler optimization than optimization level 20. During a debug session, user variables cannot be changed, but can be displayed. The presented values may not be the current values of the variables.
40
The Java program contains a compiled version of the class bytecodes and has more compiler optimization than optimization level 30. All call and instruction tracing is disabled.
Top

Enable performance collection (ENBPFRCOL)

Specifies whether collection of performance data is enabled.

For Java programs created for target release V6R1M0 and later, the value is ignored and ENDPFRCOL(*NONE) is used.

For Java programs created for a target release prior to V6R1M0, the following values may be specified, but values *ENTRYEXIT and *FULL will not be effective until the Java program is retranslated on the target release of the operating system.

*SAME
The performance data collection attribute does not change.
*NONE
The collection of performance data is not enabled. No performance data is to be collected.
*ENTRYEXIT
Performance data is collected for procedure entry and exit.
*FULL
Performance data is collected for procedure entry and exit. Performance data is also collected before and after calls to external procedures.
Top

Profiling data (PRFDTA)

The PRFDTA parameter is outdated. The parameter value is ignored and PRFDTA(*NOCOL) is used.

*SAME
*SAME is only provided for compatibility with previous versions of the operating system. It is ignored and *NOCOL is used.
*NOCOL
The Java program is not enabled to collect profiling data.
*COL
*COL is only provided for compatibility with previous versions of the operating system. It is ignored and *NOCOL is used.
*CLR
*CLR is only provided for compatibility with previous versions of the operating system. It is ignored and *NOCOL is used.
*APY
*APY is only provided for compatibility with previous versions of the operating system. It is ignored and *NOCOL is used.
Top

Merge (MERGE)

Specifies whether the Java programs attached to a Java archive (JAR) file are to be merged into the minimum number of Java programs possible. This parameter is ignored if processing a Java class file.

*RPL
Specifies that Java programs attached to the JAR file will be merged only if the Java programs need to be recreated and replaced because other attributes are being changed. If no attributes are changed, and no Java programs need to be recreated and replaced, no merging of Java programs will occur.
*YES
Merge all Java programs attached to a JAR file into the minimum number of Java programs possible.
Top

Directory subtree (SUBTREE)

Specifies whether directory subtrees are processed when looking for files that match the CLSF keyword.

*NONE
Only the files that match the object name pattern will be processed. No subtrees are processed. If the directory has subdirectories, neither the subdirectories nor the objects in the subdirectories are processed.
*ALL
The entire subtree of the path specified in CLSF is processed to change java programs for files matching the name specified on CLSF parameter.
Top

Licensed Internal Code options (LICOPT)

Specifies one or more Licensed Internal Code compile-time options. This parameter allows individual compile-time options to be selected, and is intended for the advanced programmer who understands the potential benefits and drawbacks of each selected type of compiler option.

Valid values are:

*SAME
If recreation is not required, the licensed internal code options do not change. If other parameter values force the object to be recreated, the existing licensed internal code options will be used as input to the recreation. Depending on other parameter values and conditions, not all of the input LICOPT values might take effect.
*OPTIMIZE
Use the set of compile-time options which are implicitly associated with the optimization level specified on the OPTIMIZE parameter. If OPTIMIZE(*INTERPRET) is specified, no compile-time optimizations will be performed.
'Licensed-Internal-Code-options-string'
The selected Licensed Internal Code compile-time options are used when creating the Java program object. Certain options may reduce your ability to debug the created Java program.

Note: Additional information about the LICOPT options can be found in the IBM Developer Kit for Java topic collection in the IBM i Information Center at http://www.ibm.com/systems/i/infocenter/.

Top

Examples

Example 1: Recreate a Java Program

CHGJVAPGM   CLSF('/projectA/myJavaclassname.class')
            OPTIMIZE(*INTERPRET)

This command will recreate the Java program associated with the class file myJavaclassname so that the Java program matches the current level of the operating system.

Top

Error messages

*ESCAPE Messages

JVAB524
&1 Java programs created, &4 with errors. &2 Java programs were current. &3 Java programs not created
JVAB532
Unable to create Java program for "&1".
JVAB535
Unmonitored exception received.
Top