Overview of Java generation

This section provides Java-specific information related to generating Java™ for any of the Java environments, including iSeries®. This topic includes an overview of Java generation; other topics in this section include the following information:

The process for generating Java code and other output from EGL source consists of several phases. The phases are covered briefly in the topic "Overview of EGL generation," which is listed in the related links at the end of this topic. However, there are some specific differences between the generation process for Java and the process for COBOL. This topic gives a high level overview of the process for Java generation specifically.

Here are the phases included in the generation process, along with the parts required for each phase:

Validation for the target runtime environment
The validation phase comes first. Here are the required input parts for the validation phase:
  • The part or parts to be generated.
  • The Build Descriptor part, which provides the following:
    • The target runtime environment, which is specified in the system build descriptor option.
    • The name of the linkage options part, if any, as specified in the linkage build descriptor option
    • The name of the resource associations part, if any, as specified in the resourceAssociation build descriptor option
    • A subset of build descriptor options that are used during the validation phase, such as the validateSQLStatements build descriptor option.
The validation done at generation time is specific to the target runtime environment. EGL performs the following actions during this validation:
  • Verifying that the source code is compatible with the target runtime environment.
  • Verifying that the entries in the linkage options part and the resource associations part are correct based on the target runtime environment.
  • Performing any special validation required, such as that requested with the validateSQLStatements build descriptor option.
Production
During this phase, the EGL parts are generated into Java source code. This phase requires the following inputs:
  • Validated EGL source code.
  • All build descriptor options, including those validated in validation phase.
  • Linkage options parts
  • Resource association parts
  • Other information such as the Java runtime properties set in the build descriptor part.
After generation, the output resulting from this phase consists of the following:
  • Java source code
  • A build plan that controls the preparation phase for Java, if you do not generate to a project in the workspace. The build plan is based on which build descriptor options were set.
  • Additional output based on the type of part being generated and the specific build descriptor options that are set.
Any error messages are shown in the EGL Generation Results view.
Preparation
In the third phase of the generation process, EGL prepares your output for deployment in your target runtime environment. For Java generation, the preparation phase can occur in several different ways depending on where you place the output of generation. You specify which method to use by setting certain build descriptor options as follows:
  • Generate within your workspace, and place the output of the production phase into an existing project, using the genProject build descriptor option. In this case, EGL does not create the build plan, and the build server and transfer steps are not used. If you have the workbench preference Build Automatically turned on, the preparation step (compiling the Java code and any other output of generation) occurs automatically; if that preference is not turned on, you can build the project at a later time.
  • Place the output of generation into a directory on the same workstation, but outside the workspace. This is done by setting the genDirectory option, but not setting the destHost option. In this scenario, EGL creates a build plan, which in turn starts the Java compiler on the local workstation; however, EGL does not use the build server or the transfer step.
  • Place the output of generation into a directory outside the workspace, then transfer the output to a remote system for preparation. This uses the destHost, destDirectory, and related build descriptor options. In this scenario, EGL creates a build plan to control the order of output that is sent to the remote system. The build plan also controls the build scripts that are run on the remote system.

Java build path

In addition to the EGL build path, you can set a Java build path to resolve issues with Java generation.

EGL does not automatically create your build path, which can create problems at generation time. For example, you might have a ProjectA that uses a library in ProjectB. You would need to put ProjectB in the Java build path for ProjectA.

Change your Java build path for a project by right-clicking the project name in the Project Explorer view, then clicking Properties > Java Build Path. Select any projects that contain references you need to resolve.


Feedback