matthewstorey.co.uk
In this section Introduction to USS | BPXBATCH | Using COBOL | USS Commands | Using Java

Using Java

You compile and run Java programs, as you would do on any operating system using the 'javac' and 'java' commands.
Before you start writing Java programs, see the 'Codepage conflict' section on the 'Introduction' page about square brackets.

Java JDK 1.3.1

The default installation location for Java 1.3.1 is: "/usr/lpp/java/IBM/J1.3/", the important contents are:

bin/ This contains the Java commands like 'javac', 'java' and 'jar'.
bin/classic/libjvm.x The library to include when linking JNI programs.
include/ The include directory, when compiling JNI programs.
lib/rt.zip The Java runtime classes.
demo/jrio/recjava.jar The IBM record framework classes.
lib/ext/recordio.jar The IBM record IO (JRIO) classes.

To set up the right environment variables to use Java, the following lines need adding to the '.profile'.

Java -classpath option

Under USS the '-classpath' option just uses the classes specified (in addition to the normal runtime classes), compared to the some operating systems where it uses the classes specified in addition to those already in your 'CLASSPATH' environment variable.

Using .jar files

For a full list of options for the 'jar' command, just type 'jar' by itself, The general format is:
'jar [options] [manifest name] [jar name] <classname.class> or <directory/*.*>'

A few useful examples are shown below:

jar -cvf0 <jarname.jar> ... Creates a .jar file with no compression.
jar -cMvf0 <jarname.jar> ... Creates a .jar file with no compression or manifest.
jar -tvf <jarname.jar> Displays the list of files contained in a .jar file.
jar -xvf <jarname.jar> [directory name] Extract the files from a .jar file.

To use the .jar file either add it to your 'CLASSPATH' environment variable or type: 'java -classpath <jarname.jar> <classname>'

Using .properties files

If you are using .properties files outside of .jar files then they must be in EBCDIC, Java will automatically convert them to UTF-8 when they are read in.

If you are using .properties files inside of .jar files then they must be in ASCII encoded as UTF-8.

Back to top