Norris Boyd wrote:
> On Jul 31, 8:46 am, Colin Coates <[EMAIL PROTECTED]> wrote:
>> 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
>
> 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
> _______________________________________________
Thanks for your help N,
You solved my problem and I'm up and running with my scripting!
Kind Regards,
Colin
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino