Java
Overview
J2VMS is a generic calling interface for accessing native code on OpenVMS. By using a collection of classes that mimic the argument passing mechanisms of compiled languages and a helper class that is reminiscent of LIB$CALLG it is possible to call any routine found in a shareable run-time library. Also included is the ability to manipulate OpenVMS data structures using a method similar to that offered in the BLISS programming language.
Originally conceived and written by Jim Brankin, J2VMS disappeared into obscurity for some time. Kednos has since resurrected this software package and begun active development of the interface. Below is documentation and software for the latest release.
Articles relating to J2VMS have been published in the OpenVMS Technical Journal. Calling OpenVMS Native Routines From Java was published in V12. WSIT and J2VMS: A Comparative Analysis is an unpublished article that attempts to compare the merits of HP's Web Services Integration Toolkit and Kednos' Java-to-VMS Toolkit..
Software
The following J2VMS software product kits are available for download:
- J2VMS PCSI software kit, PCSI|ZIP. This kit contains V1.3 of J2VMS and is for both OpenVMS Alpha and I64.
The last release from www.j2vms.co.uk (now defunct), Version 1.2 is available from here.
Java for OpenVMS Alpha and I64 can be downloaded from HP at their website here.
Documentation
The following documentation covers the J2VMS product:
All manuals are produced using DECdocument from Touch Technologies, Inc. and Javadoc from Oracle.
For all Java on OpenVMS Alpha and I64 related documentation please visit the following HP websites:
For documentation related to the Java language and API then please consult the Oracle website.
Examples
The following are a collection of examples demonstrating the J2VMS interface. Some have corresponding native language examples that can be used to compare the two environments. All Java examples are included in the software product kit.
Hello World |
Source: |
put.java (javadoc) |
Description: |
This example simply demonstrates the declaration of an external routine (similar to the C extern construct) and calling it. In this case it is the routine LIB$PUT_OUTPUT writting that familiar message to the terminal. |
Build Instructions: |
Assuming the correct J2VMS and Java setup has been preformed, the following commands should build and execute the example program.
$ javac -classpath "/sys$library/j2vms$vs.jar" put.java
$ java -classpath "/sys$library/j2vms$vs.jar:./" put
|
Get Some Input |
Source: |
get.java (javadoc) |
Description: |
This example fetches a line of input using the LIB$ Run-Time Library routine LIB$GET_INPUT and then writes it to the terminal using LIB$PUT_OUTPUT. This example demonstrates the use of the StringBuffer class to pass a dynamic string to LIB$GET_INPUT for receiving the resulting string. |
Build Instructions: |
Assuming the correct J2VMS and Java setup has been performed, the following commands should build and execute the example program.
$ javac -classpath "/sys$library/j2vms$vs.jar" get.java
$ java -classpath "/sys$library/j2vms$vs.jar:./" get
|
Disk Driver |
Source: |
disk_driver.java |
Description: |
This program is an example that demonstrates the use of OpenVMS disk drivers using RMS and QIO services. It is based on the C module of the same name and produces identical results. The C version can be found in SYS$EXAMPLES or can be downloaded here. The following comments are from the module header:
DISK_DRIVER -- Programming example to demonstrate use of
OpenVMS disk drivers using RMS and QIO services. The module
first uses RMS $CREATE to create a file called MYDATAFIL.DAT in
the default directory and then writes one hundred 512-byte (1 disk
block) records, each of which contains the record number
repeated 512 times, using RMS $PUT. It then uses QIO services
to access, randomly read and write, and close the file, swapping the
contents of each pair of records. If any errors are detected,
the program exits with the error status associated with the
error.
|
Build Instructions: |
Assuming the correct J2VMS and Java setup has been performed, the following commands should build and execute the example program.
$ javac -classpath "/sys$library/j2vms$vs.jar" disk_driver.java
$ java -classpath "/sys$library/j2vms$vs.jar:./" disk_driver
|
Working With Locks |
Source: |
lock.java |
Description: |
This example demonstrates calling the $ENQW and $DEQW System Services from Java including modifying the lock value block. |
Build Instructions: |
Assuming the correct J2VMS and Java setup has been performed, the following commands should build and execute the example program.
$ javac -classpath "/sys$library/j2vms$vs.jar" lock.java
$ java -classpath "/sys$library/j2vms$vs.jar:./" lock
|
Get Some More Input |
Source: |
get.java |
Description: |
This example is from the J2VMS User Guide. It simply demonstrates the difference between passing java.lang.String and java.lang.StringBuffer objects by descriptor. It does this by requesting input from the user via the LIB$ Run-Time Library LIB$GET_INPUT. |
Build Instructions: |
Assuming the correct J2VMS and Java setup has been performed, the following commands should build and execute the example program.
$ javac -classpath "/sys$library/j2vms$vs.jar" get2.java
$ java -classpath "/sys$library/j2vms$vs.jar:./" get2
|