You always have at least two ways to access an AS/400 resource when your Java program is running on the Java virtual machine for AS/400. You can use either of the following interfaces:
When deciding which interface to use, consider the following factors:
If the program runs on both client and server (including the AS/400 as a client to a second AS/400) and accesses only AS/400 resources, it may be best to use the AS/400 Toolbox for Java interfaces.
If the program must access data on many types of servers, it may be best to use Java native interfaces.
Writing to AS/400 Toolbox for Java interfaces makes your program less server portable, however.
If your program must run to an AS/400 as well as other servers, you may find it better to use the facilities that are built into Java.
You must decide whether it is more important to have better Java neutrality and write a program to access the resource, or to use the AS/400 Toolbox for Java interface, which is less portable.
You must decide whether portability is more important or whether you want to take advantage of the additional function.
This request may take more resource than a Java native interface that runs under the job of the Java program.
An example of this is Data Queue access. The Data Queue interfaces of the AS/400 Toolbox for Java licensed program provide easy access to the data queue resource.
Using the AS/400 Toolbox for Java also means your program works on both a client and server to access an AS/400 data queue. It also works when running on one AS/400 to access a data queue on another AS/400.
The alternative is to write a separate program (in C, for example) that accesses the data queue. The Java program calls this program when it needs to access the data queue.
This method is more server-portable; you can have one Java program that handles data queue access and different versions of the program for each server you support.