Java version of the Rhapsody API

You can use the Java version of the API to write Java applications that interact with IBM® Engineering Systems Design Rhapsody®.

Using the Java version of the API

Since the Java™ API can be used on both Windows and Linux®, this API allows you to write cross-platform applications.

Use of the Java version of the API requires two files that can be found in the directory [Rhapsody installation directory]Share/JavaAPI:

  • Rhapsody.jar - contains the Java classes and interfaces
  • Rhapsody.dll (or Rhapsody.so for Linux) - native implementation of the Java interfaces

The .jar file should be included in the CLASSPATH of the Java project, and the .dll (or .so file) should be included in the lib path.

Note: If you are using the 32-bit version of Rhapsody, but are using the Rhapsody API for applications that will be run with a 64-bit version of Java, use the 64-bit .dll file, located in the directory [Rhapsody installation directory]Share/JavaAPI/64Bit. Similarly, if you are using the 64-bit version of Rhapsody, but are using the Rhapsody API for applications that will be run with a 32-bit version of Java, use the 32-bit .dll file, located in the directory [Rhapsody installation directory]Share/JavaAPI/32Bit.

An introductory guide to get you started with the API can be found here. It explains in detail the steps that are required to begin writing a Java application that uses the API, and provides extensive sample code.

Detailed information about the interfaces and methods that are contained in the API can be found in the Javadoc output, which is located in the [Rhapsody installation directory]\Doc\java_api directory. The file index.html is the entry point to the reference material.

Environment initialization before using Rhapsody API on Linux

An initialization script called rhp_env (located in the root of the Rhapsody installation directory) must be run before using Rhapsody on Linux.

This is done automatically when Linux users launch Rhapsody as described in the documentation. However, this script must also be run by Linux users who run Java applications that use the Rhapsody API.

When you write a Java application that uses the Rhapsody API, make sure to inform the users of the application that they must run the initialization script before running the Java application.

Alternatively, you can try to automate this process for the users of your application, for example, by having the script run as part of each users Linux startup process, or by including a call to this script in the script file you provide for launching your Java application (provided that Rhapsody is installed in the same location on each user's computer).