Example Java Project
The Authentic Desktop 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 AuthenticDesktopControl 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 |
AuthenticActiveX.jar | Java classes of the Authentic Desktop ActiveX control |
AuthenticActiveX_JavaDoc.zip | Javadoc file containing help documentation for the Java API |
AuthenticDesktopContainer.java | Java example source code |
AuthenticDesktopContainerEventHandler.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. |
XMLTreeDialog.java | Java example source code |
What the example does
The example places one AuthenticDesktop document editor window, the Project window, the Info window and an Authentic entry helper in an AWT frame window. It reads out the File menu defined for Authentic 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 Authentic Desktop, which is registered as an automation server, or activates Authentic Desktop if it is already running.
•Loading Data in the Controls: Locates one of the example documents installed with Authentic Desktop 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 Authentic Desktop events.
•Creating an XML Tree: Shows how to create an XML tree and prepare it for modal activation.
Updating the path to the Examples folder
Before running the provided sample, you may need to edit the AuthenticDesktopContainer.java file. Namely, check that the following path refers to the actual folder where the Authentic Desktop example files are stored on your operating system:
// Locate samples installed with the product. |
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 AuthenticDesktopContainer.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.