Where allowed to run: All environments (*ALL) Threadsafe: No |
Parameters Examples Error messages |
The Run Java Program (JAVA) command runs the Java program associated with the specified Java class. If no Java program exists, one is created and associated with the class file.
This command can operate on files in any file system that supports the integrated file system APIs.
Top |
Keyword | Description | Choices | Notes |
---|---|---|---|
CLASS | Class file or JAR file | Path name, *VERSION | Required, Positional 1 |
PARM | Parameters | Single values: *NONE Other values (up to 200 repetitions): Character value |
Optional, Positional 2 |
CLASSPATH | Classpath | Path name, *ENVVAR | Optional |
CHKPATH | Classpath security check level | *WARN, *SECURE, *IGNORE | Optional |
OPTIMIZE | Optimization | *JIT, *INTERPRET, 10, 20, 30, 40 | Optional |
INTERPRET | Interpret | *OPTIMIZE, *YES, *NO, *JIT | Optional |
PROP | Properties | Single values: *NONE Other values (up to 100 repetitions): Element list |
Optional |
Element 1: Property name | Path name | ||
Element 2: Property value | Character value, *NONE | ||
GCHINL | Garbage collect initial size | 256-240000000, *DFT | Optional |
GCHMAX | Garbage collect maximum size | 256-240000000, *DFT, *NOMAX | Optional |
GCFRQ | Garbage collection frequency | 0-100, 50 | Optional |
GCPTY | Garbage collection priority | 20, 10, 30 | Optional |
OPTION | Option | Values (up to 4 repetitions): *NONE, *VERBOSE, *DEBUG, *VERBOSEGC, *NOCLASSGC | Optional |
JOB | Job name | Name, QJVACMDSRV, *GEN | Optional |
AGTPGM | Agent program | Single values: *NONE Other values: Qualified object name |
Optional |
Qualifier 1: Agent program | Name | ||
Qualifier 2: Library | Name, *LIBL, *CURLIB | ||
AGTOPTIONS | Agent options | Character value, *NONE | Optional |
OUTPUT | Output | Single values: *PRINT, *NONE Other values: Element list |
Optional |
Element 1: Destination | * | ||
Element 2: Program end action | *PAUSE, *CONTINUE |
Top |
Specifies the class name or jar file 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') identifies a class qualified by two package names.
A jar file name may be specified only when running JDK 1.2 or higher. The start up class must be indicated by the Main-Class in the manifest header.
Top |
Specifies one or more parameter values that are passed to the Java program. A maximum of 200 parameter values can be passed.
Top |
Specifies the path used to locate classes. Directories are separated by colons.
Top |
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 is a security exposure because it may contain a class file with the same name as the one you want to run. Whichever class file is found first is run.
Top |
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 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 interprets the class 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).
If *OPTIMIZE is specified for the Interpret (INTERPRET) parameter, all of the classes that run will be run interpreted even if there is an optimized Java program associated with the class.
Top |
Specifies how the Java class files should be run.
Top |
Specifies a list of values to assign to Java properties. Up to 100 properties can have a value assigned.
Single values
Element 1: Property name
Element 2: Property value
Top |
Specifies the initial size, in kilobytes, of the garbage collection heap. This is used to prevent garbage collection from starting on small programs.
Top |
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.
Top |
Specifies the relative frequency that garbage collection runs.
This parameter is no longer supported. It exists solely for compatibility with the releases earlier than Version 4 Release 3 Modification 0 of the server.
Top |
Specifies the priority of the tasks running garbage collection.
This parameter is no longer supported. It exists solely for compatibility with the releases earlier than Version 4 Release 3 Modification 0 of the server.
Top |
Specifies special options used when running the Java class.
Top |
Specifies the name that is associated with the batch immediate (BCI) job that is started when this command is run. The BCI job is where the Java program will be run.
Top |
Specifies an ILE service program or i5/OS PASE program that contains a virtual machine (VM) agent. For example, a VM agent can be a remote debugger or profiler. The VM loads the agent program and looks for the entry point:
jint JNICALL JVM_OnLoad(JavaVM *jvm, char *options, void *reserved);
The VM calls the JVM_OnLoad function, passing a pointer to the JavaVM instance as the first argument, and the character string specified in the AGTOPTIONS parameter as the second argument. The third argument to JVM_OnLoad is reserved and set to NULL.
Single values
Qualifier 1: Agent program
Qualifier 2: Library
Top |
Specifies a character string of the virtual machine (VM) agent options. A pointer to this character string will be passed as the second argument to the JVM_OnLoad function in the VM agent program specified in the AGTPGM parameter. The format of the options string is determined by the agent program.
Top |
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.
Single values
Element 1: Destination
Element 2: Program end action
Top |
Example 1: Run a Java Program
JAVA CLASS('projectA.myJavaclassname')
This command will run the iSeries Java program associated with the class myJavaclassname. The job name of the batch immediate (BCI) job where the Java program will run will be QJVACMDSRV.
Example 2: Generate the Job Name for the Java Program
JAVA CLASS('projectA.myJavaclassname') JOB(*GEN)
This command will run the iSeries Java program associated with the class myJavaclassname. The job name of the batch immediate (BCI) job where the Java program will run will be MYJAVACLAS.
Top |
*ESCAPE Messages
Top |