Example Java Project

www.altova.com Imprimir este apartado Página anterior Subir un nivel Página siguiente

Inicio >  Referencia del programador > The UModel API > API Usage Examples > Java >

Example Java Project

The UModel installation package contains an example Java project, located at C:\Users\<username>\Documents\Altova\UModel2019\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:

 

AltovaAutomation.dll

Java-COM bridge: DLL part

AltovaAutomation.jar

Java-COM bridge: Java library part

UModelAPI.jar

Java classes of the UModel API

RunUModel.java

Java example source code

BuildAndRun.bat

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

.classpath

Eclipse project helper file

.project        

Eclipse project file

UModelAPI_JavaDoc.zip

Javadoc file containing help documentation for the Java API

Readme.txt

This file

 

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:

 

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

 

The Java binary folder must be that of a JDK 1.5 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.

© 2019 Altova GmbH