Create Java Program (CRTJVAPGM)

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

The Create Java Program (CRTJVAPGM) command creates a Java program from a Java class file, JAR file, or ZIP file. The resulting Java program object becomes part of the class file, JAR file or ZIP file object. The Java program runs when started by the JAVA (Run Java Program) command. The size and performance of the Java program can be controlled through use of the OPTIMIZE and LICOPT parameters.

If a JAR file or ZIP file is specified, only one Java program is created and associated with this file. The Java program contains an optimized internal form for all of the classes in the JAR file or ZIP 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
CLASSPATH Classpath Path name, *NONE, *ENVVAR Optional
JDKVER Java developer kit version Character value, *NONE Optional
OPTIMIZE Optimization 10, *INTERPRET, 20, 30, 40 Optional
USRPRF User profile *USER, *OWNER Optional
USEADPAUT Use adopted authority *NO, *YES Optional
REPLACE Replace program *YES, *NO Optional
ENBPFRCOL Enable performance collection *NONE, *ENTRYEXIT, *FULL Optional
PRFDTA Profiling data *NOCOL, *COL Optional
SUBTREE Directory subtree *NONE, *ALL Optional
TGTRLS Target release Character value, *CURRENT Optional
LICOPT Licensed Internal Code options Character value, *OPTIMIZE Optional
LICOPTFILE LIC options file Path name, *NONE Optional
Top

Class file or JAR file (CLSF)

Specifies the class file , JAR file, or ZIP file name from which to create 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

Classpath (CLASSPATH)

Specifies the path used to locate classes for inter-JAR binding. Directories are separated by colons.

*NONE
No additional directories or JAR files are added to the class path for locating classes.
*ENVVAR
The class path is determined by the environment variable CLASSPATH.
class-path
Path used to locate classes. An example class path is '/directory1/directory2:/QIBM/ProdData/Java400'.

Either CLASSPATH or JDKVER must be specified for inter-JAR binding to occur. CLASSPATH must be *NONE when CLSF is a class file.

Top

Java developer kit version (JDKVER)

Specifies the Java Development Kit (JDK) version to add to the class path for locating classes for inter-JAR binding.

*NONE
No additional directories for this JDK version are added to the class path for locating classes.
Java-Development-Kit version
The jar files and directories for this JDK version are added to the class path for locating classes. An example JDK version is '1.2.2'.

Either CLASSPATH or JDKVER must be specified for inter-JAR binding to occur. JDKVER must be *NONE when CLSF is a class file.

Top

Optimization (OPTIMIZE)

Specifies the optimization level of the Java program. For OPTIMIZE(*INTERPRET), the resulting Java program will be pre-verified and converted to an internal form. Then, it will be interpreted when it runs. For other optimization levels, the Java program contains server machine instruction sequences that are run when the Java program is invoked. These server machine instructions have been optimized based on the specified optimization level. The server directly runs the machine instructions when the program runs.

OPTIMIZE(*INTERPRET) Java programs are smaller but run slower than Java programs created with higher optimization levels. As the optimization level is increased beyond 10, the Java program performance generally improves, but the time required to create the Java program increases and debugging is more difficult.

10
The Java program contains a compiled version of the class byte codes 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 byte codes when it is started.. Variables can be displayed and modified while debugging.
20
The Java program contains a compiled version of the class byte codes 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 byte codes 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 byte codes and has more compiler optimization than optimization level 30. All call and instruction tracing is disabled.
Top

User profile (USRPRF)

Specifies whether the authority checking done while this program is running should include only the user who is running the program (*USER) or both the user who is running the program and the program owner (*OWNER). The profiles of the program user or both the program user and the program owner are used to control which objects can be used by the program, including the authority the program has for each object. Only the program owner or a user with QSECOFR authority can change the user profile attribute.

*SAME
The user profile attribute does not change.
*USER
The program runs under the user profile of the program's user.
*OWNER
The user profiles of both the program's owner and the program's user are used when the program is processed. The collective sets of object authority in both user profiles are used to find and access objects during program processing. Authority from the owning user profile's group profile is not included in the authority for the running program.
Top

Use adopted authority (USEADPAUT)

Specifies whether program adopted authority from previous programs in the call stack will be used as a source of authority when this program is running.

*NO
Program adopted authority from previous call levels is not used when this program is running.
*YES
Program adopted authority from previous call levels is used when this program is running. If an authorization list is specified for the QUSEADPAUT system value and the user is not authorized to that authorization list, *NO is used.
Top

Replace program (REPLACE)

Specifies whether an existing Java program associated with this file is replaced with the new Java program being created.

*YES
The existing Java program associated with this file is replaced by the new Java program created.
*NO
An existing Java program associated with this file is replaced only if the class file was changed since the existing program was created; otherwise, creation of the new Java program is stopped and a message is displayed. If a pattern was used to indicate multiple creations, processing continues with the next file.
Top

Enable performance collection (ENBPFRCOL)

Specifies whether collection of performance data is enabled.

*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)

Specifies the program profiling data attribute for the module. Program profiling is an advanced optimization technique to reorder procedures and code within the procedures based on statistical data (profiling data)

*NOCOL
The Java program is not enabled to collect profiling data.
*COL
This Java program is enabled to collect profiling data.

Note: *COL can be specified only when the optimization level of the Java program is 30 or greater and is not being changed.

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 create java programs for files matching the name specified on CLSF parameter.
Top

Target release (TGTRLS)

Specifies the release of the operating system on which you intend to use the object being created. When specifying the target-release value, the format VxRxMx is used to specify the release, where Vx is the version, Rx is the release, and Mx is the modification level. For example, V4R2M0 is version 4, release 2, modification level 0.

Valid values depend on the current version, release, and modification level, and they change with each new release.

*CURRENT
The object is to be used on the release of the operating system currently running on your system. The object can also be used on a system with any subsequent release of the operating system installed.
target-release
Specify the release in the format VxRxMx. The object can be used on a system with the specified release or with any subsequent release of the operating system installed.
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.

*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 reference in the iSeries Information Center at http://www.ibm.com/eserver/iseries/infocenter.

Top

LIC options file (LICOPTFILE)

Specifies a file name which lists one or more Licensed Internal Code compile-time options.

*NONE
There is no file specified.
'Licensed-Internal-Code-options-filename'
The file is used for specifiying which 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 reference in the iSeries Information Center at http://www.ibm.com/eserver/iseries/infocenter.

Top

Examples

Example 1: Create an Optimized Java Program

CRTJVAPGM   CLSF('/projectA/myJavaclassname.class')
            OPTIMIZE(10)

This command will create a Java program and associate it with the class file myJavaclassname. The Java program will contain compiled machine instruction sequences which will be run when the Java program is invoked via the RUNJVA (Run Java) or the JAVA CL command.

Example 2: Create a Java Program Specifying a LICOPT File

CRTJVAPGM   CLSF('/projectA/myJavaclassname.class')
            LICOPTFILE('/projectA/mylicoptfile.txt')

This command will create a Java program and associate it with the class file myJavaclassname. The command will read the Licensed Internal Code options contained in the text file mylicoptfile.txt and prepend them to the default Licensed Internal Code Options used when generating compiled machine instruction sequences.

Example 3: Create Numerous Java Programs

CRTJVAPGM   CLSF('/projectA/*.class') SUBTREE(*ALL)

This command will create a Java program and associate it with any class file in the projectA directory and any class file in directories below projectA.

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