Command line invocation of Java API

Technote (FAQ)


Question

How do you invoke an IBM Rational Rhapsody Java API from the command line?

Answer

Use the "java" command through a batch (.bat) file.

The "java" command takes 3 arguments which are explained below:

  1. Lib Path: Path to Rhapsody.jar

  2. Classpath: It takes 3 values separated by commas
    • Path to the directory containing .classpath file
    • Path to the rhapsody.jar file
    • Path to the directory containing the topmost package

  3. Main class: Name of the main class qualified/starting from its top most package

To understand the values for these arguments/parameters, consider the below scenario:
  • Rhapsody is installed in directory "C:/Telelogic/Rhapsody" and the Rhapsody.jar file is avaiable in location "C:/Telelogic/Rhapsody/Share/JavaAPI".
  • The .classpath is available in the directory "C:/UserArea/Rhapsody/prjConnect/bin"
  • Topmost package of the API is "C:/UserArea/Rhapsody/prjConnect/bin"
  • The topmost package is named as "pkgConnect"
  • The main class is named "clsConnect"

The contents of the bat file for the above scenario would be:

java -Djava.library.path=C:/Telelogic/Rhapsody/Share/JavaAPI -classpath C:/UserArea/Rhapsody/prjConnect/bin;C:/Telelogic/Rhapsody73/Share/JavaApi/rhapsody.jar;C:/UserArea/Rhapsody/prjConnect/bin/ pkgConnect.clsConnect


Note: Saving the above text as a .bat file would create the batch file.

This batch file can then be run directly from the command prompt to invoke the API code.

Even Java plugins can be run outside Rhapsody using the above steps.


Rate this page:

(0 users)Average rating

Document information


More support for:

Rational Rhapsody
Rational Rhapsody Developer

Software version:

7.5

Operating system(s):

Windows

Reference #:

1397601

Modified date:

2011-06-01

Translate my page

Machine Translation

Content navigation