Skip to main content (Press Enter).
Sign in
Skip auxiliary navigation (Press Enter).
Skip main navigation (Press Enter).
Toggle navigation
Home
Groups
Events
Upcoming Community Events
All Community Events
Development and Pipeline - Group home
Back to Blog List
Develop a Java Application for z/OS with IDz 15.0 in Minutes
12
Like
Java
is a very widely used and important programming language. It is portable, consumable, pervasive and performs extremely well on the
mainframe.
Check out
this article
for more great reasons to use Java on Z.
Eclipse
, which is written in Java, provides a rich Java tooling platform for developing applications. What you might not know is you can use the
JDT
(Java Development Tools) in concert with
IBM Developer for z/OS
and the
JZOS
Toolkit to develop mainframe Java applications with ease. In this article, I'll share steps you can take to create, install, run and debug a simple z/OS Java application in minutes.
Note that if you're interested in developing with IBM Semeru (Java) 11, you will need to use
IDz 16
or higher.
The tool set in IBM Developer for z/OS 15.0 is vast so, to keep users focused, capabilities outside of the typical ones needed by z/OS developers are hidden by default. To get started, you will need to enable Java development. Go to Preferences->General->Capabilities, expand the Development node, select the Java Development checkbox and then press Apply:
Once Java is enabled, you can switch to the Java Perspective. There you can develop a Java application locally just like you would on any platform. Use the Java Project wizard to create a new project. On the Java Settings page of the wizard, select the Libraries tab and add the
IBM JZOS Toolkit Library
. Once the project is created, you can use the Java Class Wizard to set the stage for coding.
When editing Java in Eclipse, functionality like content assist, open declaration, templates, and a variety of other features are at your disposal. The editor is aware of the JRE system library but also, because the
JZOS
library is associated with the project, it also helps you program to z/OS.
In this example, we have a "Hello World" type application that reads the records of a PDS member and prints them to standard output. When you're ready to run, take advantage of the
Remote JAR Export Wizard
. This wizard compiles your Java source into a JAR and then transports it to a specified remote location.
Notice the option on the JAR Packaging Options page to save the JAR export configuration. This creates a configuration file, in this example, helloz.rmtjardesc, that allows you to export the JAR at any time without having to step through the wizard again. If you change your code and want to run it again, simply select the export configuration file and right-mouse-click->
Create Remote JAR
:
With the program residing on the mainframe, you can now create a launch configuration to test your Java application. Select the Run toolbar action to open the Run Configurations dialog. Then create a new
Host Java Application
launch configuration. On the Main page, specify the Remote System Explorer connection to your mainframe, the project and the main class. On the Classpath page, add the JAR you exported to the mainframe. Since this example application takes a PDS member name as an argument, one gets added to Program Arguments on the Arguments tab. When you click Run, you're taken to the Debug perspective while the Java application runs on z/OS (make sure you have Java in your PATH on the host system). The output is displayed in the Console view.
If you later decide you want to debug the application, simply select the launch configuration that was used for run from the Debug toolbar menu:
The application is launched again but this time you're debugging it.
While developer tools for traditional mainframe languages like COBOL is paramount, capabilities that go beyond the traditional take you the extra mile. Starting with Eclipse Java tooling, IDz's integration with the IBM JZOS Toolkit Library, the Remote JAR Exporter and the Host Java Application launch configuration lets you deploy Java seamlessly.
Comments
Laura Rudolph
Tue June 21, 2022 08:09 PM
Thank you so very much for this! Your thoroughness helped me bridge the gap between USS and IDz, and get the Java editor working on my code, and showed me how to use ZFile in more detail than the sample code. This page is making me much more productive. Again, thank you!
Copyright 2024 IBM Z and LinuxONE Community. All rights reserved.
Powered by Higher Logic
×
Group Tags
Add a tag
x
User Tags may not contain the following characters: @ # $ & :