How To
Summary
You might want to use a distributed operating system such as Windows to write and compile Java code that you intend to run on z/OS®. For example, you might want to build your code by using an Eclipse-based software development tool, and Eclipse is not available on z/OS. However, IBM® Semeru Runtime Certified Edition for z/OS contains classes that do not exist in Semeru Runtimes on other operating systems. If your Java™ code uses these classes, it will not build successfully on distributed operating systems unless you copy these extra classes to your development environment.
Environment
The extra classes are in the following .jmod files:
- ibm.crypto.hdwrcca.jmod
- ibm.crypto.zsecurity.jmod
- ibm.jzos.jmod
- ibm.crypto.ibmjcehybrid.jmod
- java.base.jmod
Complete the following steps to create a .jar file from each .jmod file, then add it to your Java project in Eclipse. These steps assume that you have Eclipse (or an Eclipse-based application) and that your Eclipse installation contains a Java development plug-in with Semeru Runtime for Windows 10 or similar.
Steps
- In UNIX System Services (USS), run the following commands from a directory of your choice for each .jmod file that your code requires. The commands create a .jar file that contains the contents of the .jmod file.
-
Extract the classes from the .jmod file to a temporary directory called extraction:
Where <zos_jmod_file> is the name of the .jmod file. The $JAVA_HOME environment variable contains the full path of the Semeru Runtime for z/OS installation, up to and including the J11.0_64 subdirectory.$JAVA_HOME/bin/jmod extract --dir ./extraction $JAVA_HOME/jmods/<zos_jmod_file>
-
Change to the classes directory then create the .jar file:
cd ./extraction/classes
Where <zos_jar_file> is the name of the .jar file. You can use any name you like but it’s advisable to include the name of the .jmod file so you can easily find the file later.$JAVA_HOME/bin/jar cf ../../<zos_jar_file> *
-
Change to the extraction directory then add other required files to the .jar file
cd ..
$JAVA_HOME/bin/jar uf ../<zos_jar_file> ./legal/* ./lib/*
-
Change to the parent directory then delete the extraction directory and its contents, which are no longer required:
cd ..
rm -r extraction
-
-
Copy (for example by using the sftp command) the .jar files that you created to your Windows machine, to a folder of your choice.
- On your Windows machine, add the .jar files to your Java project in Eclipse:
-
In the Package Explorer view, right-click your Java project, then click Build Path > Configure Build Path… . The Properties dialog for the project opens, with the Java Build Path panel showing.
-
Click the Libraries tab.
-
Click the Add External JARs... button to open the JAR Selection dialog.
-
Find the .jar files in the filesystem, select all of them (for example by pressing Ctrl while clicking each file), then click Open to add the .jar files to the build path.
-
Click Apply and Close to save your changes.
-
Example
After you create a .jar file from the ibm.crypto.hdwrcca.jmod file and copy it to your distributed operating system, the following example Java code builds successfully:
.
import com.ibm.crypto.hdwrCCA.provider.*;
public class hdwrccaTest {
public static void main(String[] args) {
System.out.println ("Testing hdwrCCA access and Semeru 11");
com.ibm.crypto.hdwrCCA.provider.IBMJCECCA cca = new com.ibm.crypto.hdwrCCA.provider.IBMJCECCA();
IBMJCECCA cca2 = new IBMJCECCA();
}
}
Document Location
Worldwide
Was this topic helpful?
Document Information
More support for:
IBM Semeru Runtimes
Software version:
11.0.0
Operating system(s):
z/OS
Document number:
6986587
Modified date:
03 May 2023
UID
ibm16986587