Generating Java code
You can generate program code for Java SE JDK 8, 11, 17, 21 (including OpenJDK). Note the following when generating code:
•Certain MapForce features are not supported in generated program code. For details, see Supported features in generated code.
•You can generate code either from a single mapping design (.mfd), or from a mapping project (.mfp). If you generate code from a single mapping, the resulting application executes the respective mapping transformation. If you generate code from a MapForce project (.mfp) which includes multiple mappings, the resulting application executes in bulk all mappings included in the project.
•You can change the general code generation options from the Tools | Options menu, Generation tab. See Code Generator Options.
•You can change the name of the generated mapping application and other settings from the File | Mapping settings menu. The default application name is Mapping. See also Changing the Mapping Settings.
•For information about handling paths in generated code, see Paths in Various Execution Environments.
•If your mapping contains database components, you can view database specific settings by clicking a database component, and then selecting the menu option Component | Properties. See Database Component Settings.
•Support for database connections varies by platform and there are connection kinds that are not supported on all platforms. If your mapping connects to a database, choose a database connection that is compatible with the target environment for which you generate code. For details, see Database mappings in various execution environments.
A typical Java project generated by MapForce includes the following:
•Several Altova-signed Java packages required by the mapping (all prefixed with com.altova).
•The com.mapforce package, which includes the mapping application and dependent files (as shown below, it is possible to change the name of this package). The two most important files in this package are as follows:
oThe Java mapping application as a dialog application (MappingApplication.java).
oThe Java mapping application as a console application (MappingConsole.java).
•A build.xml file which you can execute with Apache Ant to compile the project and generate JAR files.
Sample MapForce-generated Java application (Eclipse IDE)
This section includes the following topics:
•Generating code from a mapping
•Generating code from a mapping project