Question & Answer
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:
- Lib Path: Path to Rhapsody.jar
- 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
- 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.
[{"Product":{"code":"SSB2MU","label":"IBM Engineering Systems Design Rhapsody"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Rational Rhapsody Developer","Platform":[{"code":"PF033","label":"Windows"}],"Version":"7.5","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]
Product Synonym
Rational Rhapsody
Was this topic helpful?
Document Information
Modified date:
27 May 2022
UID
swg21397601