Java API Example
The UModel installation package contains an example Java project, located at C:\Users\<username>\Documents\Altova\UModel2022\UModelExamples\API. This folder contains Java examples for the UModel API. 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.
The Java examples folder contains all the files required to run the example project. These files are listed below:
Java-COM bridge: DLL part
Java-COM bridge: Java library part
Java classes of the UModel API
Java example source code
Batch file to compile and run example code from the command line prompt. Expects folder where Java Virtual Machine resides as parameter.
Eclipse project helper file
Eclipse project file
Javadoc file containing help documentation for the Java API
The example starts up UModel and performs a few operations, including opening and closing documents. When done, UModel stays open. You must close it manually.
Running the example from the command line
To run the example from the command line, open a command prompt window, go to the Java folder of the API Examples folder (see above for location), and then type:
The Java binary folder must be that of a JDK 1.7 or later installation on your computer.
Press the Return key. The Java source in RunUModel.java will be compiled and then executed.
Loading the example in Eclipse
Open Eclipse and use the File | Import... | General | Existing Projects into Workspace command to add the Eclipse project file (.project) located in the Java folder of the API Examples folder (see above for location). The project RunUModel will then appear in your Package Explorer or Navigator.
Select the project and then the command Run as | Java Application to execute the example.
|Note:||You can select a class name or method of the Java API and press F1 to get help for that class or method.|