How to compile a Gen java user exit
search cancel

How to compile a Gen java user exit

book

Article ID: 52742

calendar_today

Updated On:

Products

Gen

Issue/Introduction

Changes were made to a Gen 8.6 java user exit called CFBDynamicMessageEncodingExit.java and it needs to be compiled to produce a new .class file that can be used at runtime. How can this user exit be compiled? What Gen files need to be referenced in order for a successful compilation?

Environment

Component: Gen Web Generation

Resolution

In order to compile a Gen java user exit such as the exit CFBDynamicMessageEncodingExit.java, the following steps need to be performed:

  1. Create a Runtime JAR file:

    Example 1: Using the mkjavart command

    Before executing the command to compile the user exit, we need to create a jar file containing the Gen java runtime classes. These class files will be referenced in the command used to compile the user exit. To do this, open a DOS prompt and change to the %Gen86%\classes directory. Type the command as shown below and press Enter:

         mkjavart genrt.jar All

    genrt.jar is the jar file name used in this example. You can give it any name you want with a .jar extension. 'All' is the option used in this example although there are other options available also (type mkjavart and press Enter to see the options).

    Example 2: Using the genrt.jar file

    Alternatively, if you have already assembled your Gen Web Application, then you should have a genrt.jar file in the <model.ief>\java\deploy.j2ee folder. This file can also be referenced in the command used to compile the user exit as it contains the needed class files.

    In essence, you can use either the runtime jar file that was created using the mkjavart command or the one present in the deploy.j2ee folder.


  2. Compile the User Exit:

    Example 1: Using the classes\genrt.jar file

    Open a DOS prompt and change to the directory where the user exit is located, for e.g. %Gen86%\classes\com\ca\gen\exits\msgobj\cfb. Once you have changed to the location, type the command as shown below:

        javac -classpath "%Gen86%\Gen\classes\genrt.jar" CFBDynamicMessageEncodingExit.java

    Upon a successful execution of the command, it should return to an empty prompt. The cfb folder should now have an updated class file for the user exit.

    Example 2: Using the deploy.j2ee\genrt.jar file

    Open a DOS prompt and change to the directory where the user exit is located, for e.g. %Gen86%\classes\com\ca\gen\exits\msgobj\cfb. Once you have changed to the above location, type the command as shown below:

         javac -classpath C:\models\sample.ief\java\deploy.j2ee\genrt.jar CFBDynamicMessageEncodingExit.java

    The above example references the genrt.jar file present in the Sample model's deploy.j2ee folder. Upon a successful execution of the command, it should return to an empty prompt. The cfb folder should now have an updated class file for the user exit.

Additional Information

Reference about Web Generation User Exits.