There are some special considerations for running the IBM® Toolbox for Java™ classes on the IBM Developer Kit for Java (IBM i) Java virtual machine (JVM).
Two common ways to call a command are to use one of the following:
The CommandCall class generates a list of messages that are available to the Java program once the command completes. This list of messages is not available through java.lang.Runtime.exec().
The java.lang.Runtime.exec method is portable across many platforms, so if your program must access files on different types of servers, java.lang.Runtime.exec() is a better solution.
Common ways to access a file in the IBM i integrated file system:
The IBM Toolbox for Java integrated file system classes have the advantage of providing more function than the java.io classes. The IBM Toolbox for Java classes also work in applets, and they do not need a method of redirection (such as IBM i Access for Windows®) to get from a workstation to the server.
The java.io classes are portable across many platforms, which is an advantage. If your program must access files on different types of servers, java.io is a better solution.
If you use java.io classes on a client, you need a method of redirection (such as the IBM i Access for Windows) to get to the server file system.
Two IBM-supplied JDBC drivers are available to programs running on the IBM i JVM:
The IBM Toolbox for Java JDBC driver is best to use when the program is running in a client/server environment.
The IBM Developer Kit for Java JDBC driver is best to use when the program is running on the server.
If the same program runs on both the workstation and the server, you should load the correct driver through a system property instead of coding the driver name into your program.
Two common ways to call a program are as follows:
The IBM Toolbox for Java ProgramCall class has the advantage that it can call any server program.
You may not be able to call your server program through JNI. An advantage of JNI is that it is more portable across server platforms.