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:
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.
The limit for the CLASS parameter is 5000 characters.
Optional parameters:
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.
The limit for the PARM parameter is 256 characters.
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'
The limit for the CLASSPATH parameter is 5000 characters.
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.
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:


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


The PROP parameter specifies a list of values to assign to Java system properties. You can assign up to 100 properties.
The limit for the PROP parameter is 5000 characters each
for name and value.
For property-name, specify the name of the property to change.
For property-value, specify the value that is assigned to the property.
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.
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.
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.
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.
The OPTION parameter specifies special options that are used when a Java class 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 ] |