13.1. Installing the API Library

Engineering Knowledge Manager

Administration Guide | Chapter 13: EKM Client API |

Chapter 13: EKM Client API |  | 13.2. Using the Library in Client Applications
Prev |  | Next

## 13.1. Installing the API Library

The EKM Client API library is installed along with the EKM server product. Under the EKM installation directory, the following directories are provided for the library:

`EKM_ROOT182/ekm-client` - the home directory for the library
`EKM_ROOT182/ekm-client/bin` - scripts for running Jython and for building and running the included Java samples
`EKM_ROOT182/ekm-client/lib` - Java and C# libraries
`EKM_ROOT182/ekm-client/programs` - additional programs needed to build and run the Java samples
`EKM_ROOT182/ekm-client/samples/CSSamples` - example application written in C#
`EKM_ROOT182/ekm-client/samples/ironpython` - example applications written in Python for execution using IronPython
`EKM_ROOT182/ekm-client/samples/java` - example applications written in Java
`EKM_ROOT182/ekm-client/samples/jython` - example applications written in Python for execution using Jython
`EKM_ROOT182/ekm-client/schema` - schema files

After the installation is complete, do the following to build and run the Java and Jython examples:

1. Edit the `EKM_ROOT182/ekm-client/bin/ekm_env` script.

2. Set the `EKM_BASE` environment variable to the value of `EKM_ROOT182`, where `EKM_ROOT182` is the directory in which the `ekm-client` directory resides.

3. Set the `JAVA_HOME` environment variable to the location of the JDK.

4. Add the `EKM_ROOT182/ekm-client/bin` directory to the path.

5. On Unix machines, use the chmod command to make all of the .sh files in `EKM_ROOT182/ekm-client/bin` executable.

6. On Unix machines, use the chmod command to make the ant script in `EKM_ROOT182/ekm-client/programs/apache-ant-1.9.1/bin` executable.

Once this has been done, the samples can be built and run in place on the server where the library was installed.

### Installing the Library on a Client Machine

Follow the steps below to install the library on a client machine.

1. Copy the `ekm-client` directory from the server install to a location on the client machine. The only prerequisite for the client machine is that it has the Java Development Kit (JDK) version 1.8.0_121 or later installed on it.

2. Open `EKM_ROOT182/ekm-client/bin/ekm_env script` in an editor.

3. Change the `EKM_BASE` environment variable to the directory in which you placed the `ekm-client` directory.

4. Change the `JAVA_HOME` environment variable to point to the JDK installation on the client machine.

5. Add `EKM_ROOT182/ekm-client/bin` to your PATH.

6. Save your changes.

7. On Unix machines, use the chmod command to make all of the .sh files in `EKM_ROOT182/ekm-client/bin` executable.

8. On Unix machines, use the chmod command to make the ant script in `EKM_ROOT182/ekm-client/programs/apache-ant-1.9.1/bin` executable.

### Testing the Installation

To test the installation, follow the steps below.

1. Execute the jython script in `EKM_ROOT182/ekm-client/bin`. This should open a jython console. For example:

       >>>Jython 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11)
       [Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_121
       Type "help", "copyright", "credits" or "license" for more information.
       >>>

2. At the prompt, enter the following commands:

       >>> from com.ansys.ingress.client.api import ConnectionFactory
       >>> conn = ConnectionFactory.open("http://host:port", "user", "password")

   The first command imports the `ConnectionFactory` class into the interpreter. The second command opens a connection to the EKM server. In the second command, replace `host:port` with the hostname and port number of the EKM server (for example, http://localhostmyekmserver.mycompany.com:8080), `user` with the EKM username, and `password` with the EKM user’s password.

   If you do not see any errors, you are connected to the EKM server.

3. Close the connection before exiting the interpreter.

       >>> conn.close()
       14:26:58,454 DEBUG EventManager:57 - Posting connection event: CONNECTION_CLOSED

Contains proprietary and confidential information of ANSYS, Inc. and its subsidiaries and affiliates.

Prev | Up / Contents | Next

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