Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Calling importClass(RhapsodyAppServer) with rhapsody.jar and rhapsody.dll

161 views
Skip to first unread message

Colin Coates

unread,
Jul 31, 2008, 8:46:34 AM7/31/08
to dev-tech-js-...@lists.mozilla.org, colin....@uk.ibm.com
Dear All,

I am trying to use Rhino to script the Rhapsody UML tool. The Rhapsody
API is exposed using JNI, through a combination of rhapsody.jar and
rhapsody.dll (on the Microsoft Windows platform). I written a simple
script called "test.js", which contains the following code:

//------------------------------------------------------------
importClass(java.lang.System);

// Load the native library from its locally installed location
System.load("c:/telelogic/rhapsody7.3/share/JavaAPI/rhapsody.dll");

importClass(com.telelogic.rhapsody.core.RhapsodyAppServer);
var ras = new RhapsodyAppServer();
//------------------------------------------------------------

I invoke this script from the command line by typing:
java -cp c:/telelogic/rhapsody7.3/share/JavaAPI/rhapsody.jar -jar js.jar
test.js

I get the error message:
js: Function importClass must be called with a class; had "[JavaPackage
com.telelogic.rhapsody.core.RhapsodyAppServer]" instead.

I have also tried invoking the script with the following command line:
java -cp c:/telelogic/rhapsody7.3/share/JavaAPI/rhapsody.jar
-Djava.library.path=c:/telelogic/rhapsody7.3/share/JavaAPI/ -jar js.jar
test.js

... which results in the same error message.

Please will anyone help me with a suggestion about what I might be doing
wrong?

Kind Regards,
Colin

Colin Coates

unread,
Jul 31, 2008, 8:40:32 AM7/31/08
to dev-tech-js-...@lists.mozilla.org

Norris Boyd

unread,
Jul 31, 2008, 10:00:53 AM7/31/08
to

The problem is that the "-jar" option overrides the classpath from the
"-cp" option. Try adding js.jar to your classpath and explicitly
naming the main class org.mozilla.javascript.tools.shell.Main.

--N

Colin Coates

unread,
Jul 31, 2008, 11:13:36 AM7/31/08
to Norris Boyd, dev-tech-js-...@lists.mozilla.org
> _______________________________________________

Thanks for your help N,

You solved my problem and I'm up and running with my scripting!

Kind Regards,
Colin

0 new messages