13.4. Building and Running a Java Application

If developing a Java application, this document assumes the reader already knows how to compile and run the code being written. The developer must include all of the JAR files in ekm-client/lib in the classpath used by the Java compiler and Java virtual machine. Also included in the ekm-client directory is a sample ANT build file called build-samples.xml that can be used to compile and run the sample Java applications. To use this, simply open a command prompt or shell, change to the ekm-client directory, and execute the run-samples script in ekm-client/bin. This will compile and execute the sample Java applications.


Important:  These samples all have hard-coded user names and passwords. You will need to modify them accordingly for your current installation. Also, the samples assume that they are running on the same computer as the EKM server. If not, they will need to be modified accordingly.


The example below shows how to execute the sample applications using Ant.

F:\ekm182\v182\ekm-client>run-samples
Buildfile: F:\ekm182\v182\ekm-client\build-samples.xml

init:
    [mkdir] Created dir: F:\ekm182\v182\ekm-client\build

compile:
    [javac] F:\ekm182\v182\ekm-client\build-samples.xml:72: warning: 'includeantruntime' was not set, 
    defaulting to build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 9 source files to F:\ekm182\v182\ekm-client\build

run-samples:

[output omitted]

     [echo] Running samples.java.Download
     [java] 15:17:37,010 DEBUG RepositoryConnectionManager:? - Open started: temp[http://machine764:8080,null]
     [java] 15:17:39,864 DEBUG RepositoryConnectionManager:? - Setup completed
     [java] 15:17:39,865  INFO RemoteRepositoryAdapter:? - Using cache: false
     [java] 15:17:40,008 DEBUG RepositoryConnectionManager:? - Open completed
     [java] >>>>> Connection Default@machine76412[http://machine764:8080,Default] opened
     [java] 15:17:40,181 DEBUG FileManagerClient:? - Created httpclient: http.conn-manager.timeout = 100
     [java] 15:17:40,325 DEBUG DownloadStage:? - Processing transfer item: /Data/My Data/test.txt
     [java] 15:17:40,356  INFO TempFileManager:? - TempFileReaper started
     [java] 15:17:40,390 DEBUG FileManagerClient:? - Shutting down connectionmanager
     [java] >>>>> Download completed
     [java] 15:17:41,496 DEBUG RepositoryConnectionManager:? - Connection closed: Default@machine76412
     [http://machine764:8080,
Default]
     [java] >>>>> Connection Default@machine76412[http://machine764:8080,Default] closed

BUILD SUCCESSFUL
Total time: 39 seconds

Release 18.2 - © ANSYS, Inc. All rights reserved.