Please enable JavaScript to view this site.

Altova MapForce 2020 Enterprise Edition

This example illustrates how to import a custom Java .class file into MapForce.


Note:Java SE 7 Runtime Environment or later is required to complete this example.

To add the Java .class file as MapForce library:

1.Click the Add/Remove Libraries button at the base of the Libraries window. The Manage Libraries window opens.


2.Do one of the following:


To import functions as a local library (in the scope of the current document only), click the Add button under the current mapping name.

To import functions as a global library (at program level), click the Add button adjacent to Global Library Imports.


Note:When you import a library locally, you can set the path of the library file to be relative to the mapping file. With globally imported libraries, the path of the imported library is always absolute.


3.Browse for the following file: <Documents>\Altova\MapForce2020\MapForceExamples\Java\Format\Format.class. A message appears informing you that a new library has been added. The imported library is now visible in the Libraries window.


If you do not see the newly imported library in the Libraries window, make sure that the transformation language is set to Java. To add the function to the mapping, drag it from the Libraries window onto the mapping area, see also Add a Function to the Mapping.

To preview the mapping output in MapForce:

1.Open the following mapping: <Documents>\Altova\MapForce2020\MapForceExamples\Java\FormatNumber.mfd. This is a complete mapping that already imports the Java .class library mentioned above.

2.Click the Output button to see the result of the mapping.


To run the mapping in Java:

1.On the File menu, click Generate Code In | Java.

2.Select a target directory where the code should be generated, and click OK.

3.Import the generated libraries into your Java project and build the Java application (see also Example: Generate and Run Java Code).

© 2020 Altova GmbH