Example: Import Custom Java Class

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  Functions > Importing Custom Java and .NET Libraries >

Example: Import Custom Java Class

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.Set the transformation language to Java (see Selecting a Transformation Language).
2.Click the Add/Remove Libraries button in the lower area of the Libraries window.
3.Next to Libraries, click Add, and select the Format.class file from the ...\MapForceExamples\Java\Format\ directory. A message appears telling you that a new library has been added. The imported library is now visible in the Libraries window.



To preview the mapping output in MapForce:

1.Open the FormatNumber.mfd file available in the ...\MapForceExamples\Java folder.
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 (for an example, see Example: Build a Java application with Eclipse and Ant ).

© 2019 Altova GmbH