Altova MapForce 2025 Enterprise Edition

The MapForce installation package contains an example Java project, located in the ActiveX Examples folder of the application folder: <ApplicationFolder>\Examples\ActiveX\Java\.

 

The Java example shows how to integrate the MapForceControl in a common desktop application created with Java. You can test it directly from the command line using the batch file BuildAndRun.bat, or you can compile and run the example project from within Eclipse. See below for instructions on how to use these procedures.

 

File list

The Java examples folder contains all the files required to run the example project. These files are listed below:

 

.classpath

Eclipse project helper file

.project        

Eclipse project file

AltovaAutomation.dll

Java-COM bridge: DLL part (for the 32-bit installation)

AltovaAutomation_x64.dll

Java-COM bridge: DLL part (for the 64-bit installation)

AltovaAutomation.jar

Java-COM bridge: Java library part

BuildAndRun.bat

Batch file to compile and run example code from the command line prompt. Expects folder where Java Virtual Machine resides as parameter.

MapForceActiveX.jar

Java classes of the MapForce ActiveX control

MapForceActiveX_JavaDoc.zip

Javadoc file containing help documentation for the Java API

MapForceContainer.java

Java example source code

MapForceContainerEventHandler.java

Java example source code

MapForceTable.java

Java example source code

 

What the example does

The example places one MapForce document editor window, the MapForce project window, the MapForce library window and the MapForce validation window in an AWT frame window. It reads out the main menu defined for MapForce and creates an AWT menu with the same structure. You can use this menu or the project window to open and work with files in the document editor.

 

You can modify the example in any way you like.

 

The following specific features are described in code listings:

 

Creating the ActiveX Controls: Starts MapForce, which is registered as an automation server, or activates MapForce if it is already running.

Loading Data in the Controls: Locates one of the example documents installed with MapForce and opens it.

Basic Event Handling: Changes the view of all open documents to Text View. The code also shows how to iterate through open documents.

Menus: Validates the active document and shows the result in a message box. The code shows how to use output parameters.

UI Update Event Handling: Shows how to handle MapForce events.

Creating a MapForce Mapping Table: Shows how to create a MapForce mapping table and prepare it for modal activation.

 

Updating the path to the Examples folder

Before running the provided sample, you may need to edit the MapForceContainer.java file. Namely, check that the following path refers to the actual folder where the MapForce example files are stored on your operating system:

 

// Locate samples installed with the product.
final String strExamplesFolder = System.getenv( "USERPROFILE" ) + "\\Documents\\Altova\\MapForce2025\\MapForceExamples\\";

 

 

Running the example from the command line

To run the example from the command line:

 

1.Check that all prerequisites are met (see Prerequisites).

2.Open a command prompt window, change the current directory to the sample Java project folder, and type:

buildAndRun.bat "<Path-to-the-Java-bin-folder>"

3.Press Enter.

 

The Java source in MapForceContainer.java will be compiled and then executed.

 

Compiling and running the example in Eclipse

To import the sample Java project into Eclipse:

 

1.Check that all prerequisites are met (see Prerequisites).

2.On the File menu, click Import.

3.Select Existing Projects into Workspace, and browse for the Eclipse project file located at <ApplicationFolder>\Examples\ActiveX\Java\. Since you may not have write-access in this folder, it is recommended to select the Copy projects into workspace check box on the Import dialog box.

 

To run the example application, right-click the project in Package Explorer and select the command Run as | Java Application.

 

Help for Java API classes is available through comments in code as well as the Javadoc view of Eclipse. To enable the Javadoc view in Eclipse, select the menu command Window | Show View | JavaDoc.

 

© 2018-2024 Altova GmbH