z/OS Unix System Services For Beginners – Java Hello World

(Originally posted 2009-04-25.)

In this post (and any others in a similar vein) I'm going to be displaying a great deal of ignorance – but I think I'm doing it in a good cause.

I know a fair amount about things like Java, XML and C++ – but NOT on z/OS. So I'm determined to learn and present what I learn as "For Beginners" posts here.

The idea is that I'll encourage other people with more traditional z/OS skills to try some simple new things, such as java. So, if you've not done these things before do have a go. Stuff is remarkably straightforward to do.

Here's how I created a simple "Hello World" java application in Unix System Services.

  1. Log onto TSO with a region of 64MB (64000 in the logon panel). When I tried this with 32000 I got a "JVMDBG001" message, complaining of not being able to GETMAIN enough memory to start the JVM (but the JVM started anyway).
  2. Type OMVS. (If your userid has been set up to use Unix System Services it should start you in a directory (mine being "/u/userid").
  3. Create a subdirectory using "mkdir javatest".
  4. Change to this subdirectory using "cd javatest".
  5. List what's in this subdirectory (actually nothing) using "ls".
  6. Create a new java source file using "oedit Hello.java".
  7. While in the (ISPF) Editor add the following lines:
    public class Hello{
      public static void main(String args[]){
  8. Press PF3 to save. (Treat the resulting dialog as any "leaving ISPF" dialog.)
  9. Compile the resulting java with "javac Hello.java".
  10. Run the compiled java bytecode with "java Hello".

And that's all there is to it. One note – if you're not familiar with java: Case is significant. Mismatches would cause problems.

The java book I used to get started (and then some) was Deitel & Deitel's "Java How To Program" but there are lots of them to choose from.

If you're more experienced at this than me please feel free to comment as you see fit. But remember this is a "For Beginners" post. I'm trying to encourage people to GET STARTED.

Published by Martin Packer

I'm a mainframe performance guy and have been for the past 35 years. But I play with lots of other technologies as well.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: