AS/400 Developer Kit for Java \ Commands and tools \ CL commands \ RUNJVA

Run Java (RUNJVA) command

Purpose:

The Run Java (RUNJVA) command runs the AS/400 Java program, which is associated with the Java class that is specified. If a Java program does not exist, one is created and associated with the class file.

Syntax:

RUNJVA Command
 
>>--RUNJVA--CLASS(--.-class-name--.--)-------------------------------------->
                    |          (1)|
                '-*VERSION----'
 
                                               (P)
>--.----------------------------------------------------------------------->
   |        .-*NONE------------------.    |
   |        | <-----------------> (2)|    |
   '-PARM(--'---parameter-value------'--)-'
 
>--.-------------------------------.--.--------------------------.---------->
   |             .-*ENVVAR----.    |  |           .-*WARN---.    |
   '-CLASSPATH(--'-class-path-'--)-'  '-CHKPATH(--+-*SECURE-+--)-'
                                              '-*IGNORE-'
 
>--.------------------------------.--.------------------------------.------->
   |            .-10---------.    |  |             .-*OPTIMIZE-.    |
   '-OPTIMIZE(--+-*INTERPRET-+--)-'  '-INTERPRET(--+-*NO-------+--)-'
                +-*JIT-------+                     |-*YES------|    
        +-20---------+                     '-*JIT------'                                    
                +-30---------+                    
                '-40---------'
 
>--.-----------------------------------------------------.------------------>
   |        .-*NONE---------------------------------.    |
   |        | <--------------------------------> (3)|    |
   '-PROP(--'---property-name--property-value-------'--)-'
 
>--.------------------------------------------------------.------------------>
   |          .-*NOMAX-------------------------------.    |
   '-GCHMAX(--'-garbage-collection-heap-maximum-size-'--)-'
      
>--.------------------------------------------------------.------------------>
   |          .-*2048--------------------------------.    |
   '-GCHINL(--'-garbage-collection-heap-initial-size-'--)-'
      
>--.---------------------------------------------------.--------------------->
   |         .-50---------------------------------.    |
   '-GCFRQ(--'-garbage-collection-frequency-value-'--)-'
      
>--.--------------------.--.--------------------------------------.---------><
   |         .-20-.     |  |          .-*NONE----------------.    |
   '-GCPTY(--+-30-+---)-'  |          | <---------------> (4)|    |
             '-10-'        '-OPTION(--'--.-*DEBUG-----.------'--)-'
                         |-*VERBOSE---|
                     |-*VERBOSEGC-|
                     '-*NOCLASSGC-'
 

Notes: (1) All other parameters are ignored if CLASS(*VERSION) is specified.
(2) A maximum of 200 repetitions.
(P) All parameters preceding this point can be specified positionally.
(3) A maximum of 100 repetitions.
(4) A maximum of 4 repetitions.

Required parameters:

CLASS

The CLASS parameter specifies the class name that is to be run. One or more package names may qualify the class name. Follow each package name with a period. For example, CLASS('pkg1.pkg2.myclass') identifies a class that is qualified by two package names.

For class-name, specify the name of the class that runs.

Start changeThe limit for the CLASS parameter is 5000 characters. End change

*VERSION
The build version for Sun Microsystems, Inc. Java Development Kit (JDK), and the Java virtual machine displays. No Java program runs.

Optional parameters:

PARM

The PARM parameter specifies one or more parameter values that are passed to the Java program. You may specify a maximum of 200 parameter values.

For parameter-value, specify the parameters to pass to the Java program.

Start changeThe limit for the PARM parameter is 256 characters. End change

*NONE
There are no input parameters to the Java program.
CLASSPATH

The CLASSPATH parameter specifies the path that is used to locate classes. Colons separate the directories.

The classpath locates classes. An example classpath:

'/directory1/directory2:/QIBM/ProdData/Java400'

Start changeThe limit for the CLASSPATH parameter is 5000 characters. End change

*ENVVAR
The environment variable CLASSPATH determines the classpath.
CHKPATH

The CHKPATH parameter specifies the level of warnings that are given for directories in the CLASSPATH that have public write authority. A directory in the CLASSPATH that has public write authority may cause a security exposure. An exposure could occur, because an undesired class may be inserted into the directory that is found before the official class.

*WARN
A warning message is sent to the QJVACMDSRV job log for each directory in the CLASSPATH that has public write authority.
*SECURE
A warning message is sent for each directory in the CLASSPATH that has public write authority. If one or more warning messages are sent, an escape message is sent and the Java program does not run.
*IGNORE
Ignore the fact that directories in the CLASSPATH may have public write authority. No warning messages are sent.
OPTIMIZE

The OPTIMIZE parameter specifies the optimization level of the AS/400 Java program that is used if no Java program has ever been associated with the Java class. Optimization is a time consuming operation, so programs run slowly the first time that they are optimized if you use the RUNJVA command instead of the CRTJVAPGM command. However, subsequent runs use the optimized form, so optimization is a one-time cost. This is true for class files, JAR files, and ZIP files.

The effect of the OPTIMIZE parameter depends on the current optimization level of the program. The current optimization level results from either the previous use of the RUNJVA command or the CRTJVAPGM command.

If the program has never run on AS/400, and no previous CRTJVAPGM command has run, then the optimization level that is selected is used before the program runs. This optimization level is stored in the class file, JAR file, or ZIP file.

If the RUNJVA command or CRTJVAPGM command has been run against the program, then the OPTIMIZE parameter on the RUNJVA command has no effect. One exception is the OPTIMIZE(*INTERPRET) parameter. This parameter forces all of the loaded Java classes to run interpretively regardless of the OPTIMIZE value of the associated Java program.

If you want to change the level of optimization of a program that has been previously optimized, use the CRTJVAPGM command or CHGJVAPGM command. Using the RUNJVA command does not create the desired optimization level. Instead, it uses the saved value that is associated with the class file, JAR file, or ZIP file.

Note:The *INTERPRET parameter behaves this way to debug code that has been previously optimized. It does not require that you delete your program, create the program again for low optimization, debug it, and then optimize it again.

If the OPTIMIZE(*INTERPRET) parameter is used, the resulting Java program is verified and converted to an internal form. Then, it is interpreted when it runs. For the other optimization levels, the internal form includes AS/400 machine instructions. These AS/400 machine instructions are optimized based on the specified optimization level. The AS/400 directly runs the machine instructions when the program runs.

OPTIMIZE(*INTERPRET) Java programs are smaller, but run slower than Java programs that are created using higher optimization levels. As the optimization level increases beyond 10, Java program performance gradually improves, but the time that is required to create the Java program increases. It is also more difficult to debug the Java program.

Typically, *INTERPRET is a good option during development and early testing, because quick edit, compile turnaround, and quality debug functions are important. As the program moves toward release, the level of optimization often increases.

This list shows how the optimization levels differ and what they do:

10
The Java program contains a transformed version of the class file bytecodes, but has only minimal additional compiler optimization. While debugging, you can display and change variables.
*INTERPRET
The Java program that is created does not contain machine specific instructions. When the program starts, it is interpreted. You can display and change variables while debugging. Start change
*JIT
No Java program that contains machine instruction sequences is created. The class runs by using the Just-In-Time (JIT) compiler. End change
20
The Java program contains a compiled version of the class file bytecodes and has additional compiler optimization. You can display and change variables while debugging.
30
The Java program contains a compiled version of the class file bytecodes and has more compiler optimization than optimization level 20. Debugging at higher optimization levels is more difficult, because optimization reduces the ability to stop at precise points in the code and display program variables.
40
The Java program contains a compiled version of the class file bytecodes and has more compiler optimization than optimization level 30. In addition, it includes optimization that disables call and instruction tracing.
Note: If your Java program fails to optimize or throws an exception at optimization level 40, use optimization level 30.
INTERPRET

The INTERPRET parameter specifies whether all Java class files should run interpretively.

OPTIMIZE
Java class files run interpretively depending on the value that is specified for the OPTIMIZE parameter. If OPTIMIZE(*INTERPRET) is specified, all Java class files run interpretively. If another value is specified for the OPTIMIZE parameter, Java class files with Java programs, which were created by using the CRTJVAPGM command and by specifying OPTIMIZE(*INTERPRET), run interpretively.
*NO
Only Java class files with Java programs, which were created by using the CRTJVAPGM command and by specifying OPTIMIZE(*INTERPRET), run interpretively. Java class files that need to create a Java program are created with the optimization level that is specified by using the OPTIMIZE parameter.
*YES
All Java class files run interpretively regardless of which OPTIMIZE value the associated Java program created. Java class files that need to create a Java program are created with the optimization level that is specified by using the OPTIMIZE parameter. Start change
*JIT
All Java class files run by using the Just-In-Time (JIT) compiler, regardless of what OPTIMIZE value was used when the associated Java program was created. End change
PROP

The PROP parameter specifies a list of values to assign to Java system properties. You can assign up to 100 properties.

Start changeThe limit for the PROP parameter is 5000 characters each for name and value. End change

*NONE
No properties are specified.

For property-name, specify the name of the property to change.

For property-value, specify the value that is assigned to the property.

GCHMAX

The GCHMAX parameter specifies the maximum amount of memory in kilobytes that the Java virtual machine can allocate. Normally, you should use the default or set this value as large as possible. However, if you are concerned about a program that uses all available memory, you can set GCHMAX to a smaller value. The default value is system dependent and model dependent.

If Java virtual machine memory allocation reaches GCHMAX, all other Java virtual machine threads are stopped while garbage collection takes place. If garbage collection cannot reduce the memory allocation, the Java virtual machine stops.

*NOMAX
The garbage collection heap grows until all system resources are gone. Then, a synchronous garbage collection starts to reclaim the resources that are no longer in use. With *NOMAX, synchronous garbage collection occurs only if all available heap storage has been used.
GCHINL

The GCHINL parameter provides a suggested threshold for initial garbage collection. If this value is equal to GCHMAX, then garbage collection does not run until the amount of memory that is allocated by the Java virtual machine approaches GCHMAX. Setting the value to a smaller value triggers an earlier garbage collection. The default value is system dependent and model dependent.

GCFRQ

Note: This parameter is no longer supported. It exists solely for compatibility with releases earlier than Version 4 Release 3 Modification 0 of the AS/400 system.

The GCFRQ parameter provides a suggested garbage collection frequency. It may or may not be honored depending on the system release and model.

Values between 0 and 100 are allowed for GCFRQ. The default parameter is 50. A lower value means less frequent garbage collection. A higher value means more frequent garbage collection.

GCPTY

Note: This parameter is no longer supported. It exists solely for compatibility with releases earlier than Version 4 Release 3 Modification 0 of the AS/400 system.

The GCPTY parameter provides a suggested garbage collection priority. It may or may not be honored depending on the system release and model.

The GCPTY parameter specifies the relative priority of the threads that run garbage collection. The priority is relative to the default user Java threads. Higher values indicate higher priority. A low priority garbage collection thread is less likely to run, because other higher priority tasks are running.

In most cases, GCPTY should be set to the default (equal) value or the higher priority value. Setting GCPTY to the lower priority value can inhibit garbage collection and cause in all Java threads to be held while the garbage collector frees storage.

20
The default parameter value is 20. This indicates that the garbage collection thread has the same priority as default user Java threads.
30
The 30 priority gives garbage collection higher priority than default user Java threads. Garbage collection is more likely to run.
10
The 10 priority gives garbage collection lower priority than default user Java threads. Garbage collection is less likely to run.
OPTION

The OPTION parameter specifies special options that are used when a Java class runs.

*NONE
No special options are used when a Java class runs.
*DEBUG
Allows the use of the AS/400 system debugger for the Java program.
*VERBOSE
A message is displayed each time a class file is loaded.
*VERBOSEGC
A message is displayed for each garbage collection sweep.
*NOCLASSGC
Unused classes are not reclaimed when garbage collection runs.

See Example: Using the Run Java (RUNJVA) command for an example that uses the RUNJVA command.


[ Information Center Home Page | Feedback ] [ Legal | AS/400 Glossary ]