Run Java (RUNJVA)
Run Java Command syntax diagram
Purpose
The Run Java (RUNJVA) command runs the iSeries 400 Java program associated with the Java class specified. If no Java program exists, one will be created and associated with the class file.
This command can operate on files in any file system that supports the Integrated File System APIs.
Required Parameters
- CLASS
- Specifies the class name to be run. The class name may be qualified by one or more package names. Each package name must be followed by a period. For example, CLASS('pkg1.pkg2.myclass') would identify a class qualified by two package names.
class-name: Specify the name of the class to be run.
*VERSION: The build version information for the Java Development Kit (JDK) and the Java Virtual Machine (JVM) is displayed. No Java program is run.
Optional Parameters
- PARM
- Specifies one or more parameter values that are passed to the Java program. A maximum of 200 parameter values can be passed.
*NONE: There are no input parameters to the Java program.
parameter-value: Specify the parameter value to be passed to the Java program.
- CLASSPATH
- Specifies the path used to locate classes. Directories are separated by colons.
*ENVVAR: The class path is determined by the environment variable CLASSPATH.
class-path: Path used to locate classes. A example class path is '/directory1/directory2:/QIBM/ProdData/Java400'.
- CHKPATH
- Specifies the level of warnings given for directories in the CLASSPATH that have public write authority. A directory in the CLASSPATH that has public write authority may result in a security exposure where an undesired class is inserted into the directory to be found before the official class.
*WARN: A warning message is sent 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 is not run.
*IGNORE: Ignore the fact that directories in the CLASSPATH may have public write authority. No warnings messages are sent.
- OPTIMIZE
- Specifies how to treat class files if no Java program is associated with the file.
For 10,20,30,40 this specifies the optimization level of the iSeries 400 Java program which will be created if no Java program is associated with the Java class file. The Java program will contain machine instruction sequences that are run when the Java program is invoked and will remain associated with the class file after the Java program has been run.
If the Java class file is determined to be downlevel or out of date, a new Java program will be created using the optimization level that was used when the previous Java program was created, instead of the value specified for this parameter.
For OPTIMIZE(*INTERPRET), the resulting Java program will interpret the class file byte codes when invoked. OPTIMIZE(*INTERPRET) Java programs will be smaller but will run slower than Java programs created with higher optimization levels. As you increase the optimization level beyond 10, the Java program performance will generally improve, but the time required to create the Java program will increase and you will have less ability to debug the Java program.
For OPTIMIZE(*JIT), no Java program containing machine instruction sequences is created if no program is associated with the class file. Rather, the class is run using the Just In Time compiler (JIT).
10: The Java program will contain a compiled version of the class file byte codes but will have only minimal additional compiler optimization. Variables can be displayed and modified while debugging.
*INTERPRET: The Java program created will not be optimized. When invoked, the Java program will interpret the class file byte codes. Variables can be displayed and modified while debugging.
*JIT: No Java program containing machine instruction sequences is created. The class is run using the Just In Time compiler (JIT).
20: The Java program will contain a compiled version of the class file byte codes and will have some additional compiler optimization performed. Variables can be displayed but not modified while debugging.
30: The Java program will contain a compiled version of the class file byte codes and will have more compiler optimization performed 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 value of the variable.
40: The Java program will contain a compiled version of the class file byte codes and will have more compiler optimization performed than optimization level 30. In addition, it includes optimization that disables call and instruction tracing.
- INTERPRET
- Specifies the mode in which to run the Java classes.
*OPTIMIZE: Whether all Java class files are run interpretively depends on the value specified for the OPTIMIZE parameter. If OPTIMIZE(*INTERPRET) was specified, all Java class files will be run interpretively. If any other value was specified for the OPTIMIZE parameter, only Java class files with Java programs created using CRTJVAPGM command and specifying OPTIMIZE(*INTERPRET) will be run interpretively.
*NO: Only Java class files with Java programs created using CRTJVAPGM command and specifying OPTIMIZE(*INTERPRET) will be run interpretively. Java class files that need a Java program created will be created with the optimization level specified in the OPTIMIZE parameter. This option allows a user to run attached DE programs, but creates *INTERPRET programs for those classes which do not already have existing programs attached by setting the OPTIMIZE(*INTERPRET).
*YES: All Java class files will be run interpretively regardless of what OPTIMIZE value the associated Java program was created. Java class files that need a Java program created will use the optimization level specified in the OPTIMIZE parameter.
*JIT: All Java class files will be run using the Just In Time compiler (JIT), regardless of what OPTIMIZE value was used when the associated Java program was created.
- PROP
- Specifies a list of values to assign to Java properties. Up to 100 properties can have a value assigned.
*NONE: No properties are specified.
Element 1: Property name
property-name: Specify the name of the property to be changed.
Element 2: Property value
property-value: Specify the value to be assigned to the property.
- GCHMAX
- Specifies the maximum size, in kilobytes, that the garbage collection heap can grow to. This is used to prevent runaway programs that consume all of the available storage. Normally, garbage collection runs as an asynchronous thread in parallel with other threads. If the maximum size is reached, all other threads are stopped while garbage collection takes place. This may adversely affect performance.
*NOMAX: The heap will grow until all system resources are depleted. Then a synchronous garbage collection is started to reclaim resources no longer in use.
heap-maximum-size: The value in kilobytes that the garbage collection heap can grow to. It is not recommended to set the maximum size less than 32768 kilobytes.
- GCHINL
- Specifies the initial size, in kilobytes, of the garbage collection heap. This is used to prevent garbage collection from starting on small programs.
2048: The default initial size is 2048 kilobytes.
heap-initial-size: The initial value of the garbage collection heap in kilobytes. It is not recommended to set the initial size less than the default of 2048 kilobytes.
- GCFRQ
- Specifies the relative frequency that garbage collection runs.
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.
- GCPTY
- Specifies the priority of the tasks running garbage collection.
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.
- OPTION
- Specifies special options used when running the Java class.
*NONE: No special options will be used when running the Java class.
*DEBUG: Allows the iSeries 400 system debugger to be used for this 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 is run.
- OUTPUT
- Specifies where output from the Java program should be sent and, if output is directed to the Java shell display, whether the shell display panel should go away when the Java program ends.
Element 1:Destination
*: A Java shell display panel will be used to display output if the Java program is run from an interactive job. If the Java program is run in a batch job, the Java program output is sent to a spooled file through the QPRINT printer device file.
*NONE: The Java program output is discarded.
*PRINT: The Java program output is sent to a spooled file through the QPRINT printer device file.
Element 2:Program End Action *PAUSE: The Java shell display panel stays until the F3, F12, or Enter key is pressed.
*CONTINUE: The Java shell display panel goes away when the Java program ends.
Example for RUNJVA
Example 1: Run a Java Program
RUNJVA CLASS('projectA.myJavaclassname')This command will run the iSeries 400 Java program associated with the class myJavaclassname.
Error messages for RUNJVA
*ESCAPE Messages
- JVAB534
- Unable to complete Java program "&1".
- JVAB535
- Unmonitored exception received.
- JVAB537
- Java shell already active in job.
- JVAB538
- Error occurred when running Java shell.
- JVAB539
- Unable to start system debugger.
- JVAB53A
- Unable to start Java shell, reason code &1.
- JVAB53B
- Java processing canceled.
- JVAB53D
- Java Development Kit could not be found.
- JVAB546
- Error detected while running java in batch mode.