Hi,
I think I am in the same boat as aschearer. I am just beginning at looking
at embeddable scripting languages. I see that it is possible to create New
java objects through Rhino and work with these objects. But is it possible
for Rhino script to interact with an existing running Java application?
For example,
I have a Java Application with a package with a class which has a private
variable int "count", a main function and another function called
jFunction(int num) { count += num; }
I run this application with Rhino embeded and then I would like to use Rhino
shell to call the jFunction from the running instance of the application
with the following script
function jFunctionCall(num) {
jFunction(num) // call the java function of the running application
}
jFunction(num)
calling this function would then add num to the count variable in the Java
object
Is this possible? I may be totally lost here at what Rhino can do. Please
let me know if you'd like me to clarify further..or if I am not making any
sense at all.
I guess the question comes down to, can I use Rhino as a command prompt /
command line interface to control my application.
Thank you very much for any help
Eric
On Sun, Oct 25, 2009 at 11:52 AM, David Parks <[email protected]>wrote:
> I don't personally play with the shell, but I don't expect you would have
> too much of a problem extending it to add your own Javascript methods. Take
> a look at the embedding tutorial to get an idea of how you can add your own
> Javascript objects. In extending the shell I suspect you'll be doing
> something like this.
>
> http://www.mozilla.org/rhino/tutorial.html
>
> Let me know if I'm off base with my thoughts here.
>
> Dave
>
>
> -----Original Message-----
> From:
> dev-tech-js-engine-rhino-bounces+davidparks21=yahoo....@lists.mozilla.org
> [mailto:dev-tech-js-engine-rhino-bounces+davidparks21<dev-tech-js-engine-rhino-bounces%2Bdavidparks21>
> [email protected]
> a.org] On Behalf Of aschearer
> Sent: Sunday, October 25, 2009 12:51 PM
> To: [email protected]
> Subject: Calling Java CLI programs through Rhino
>
> Hey, I've heard a number of things about this project before but only
> recently dipped my toe in. So far I'm really pleased by what I'm
> finding -- keep up the good work! One question I had, though, was
> whether it is possible to blend Java CLI programs with Rhino's shell.
> I would very much like to combine the scripting power provided by the
> shell with the functionality present in programs I've written. In this
> case, I am thinking a little of Microsoft's Powershell as a model. As
> far as I can tell I am not able to simply invoke a program and pass
> arguments. Is that correct? How could I go about adding that kind of
> support -- maybe it's impossible since I suppose "program -f arg"
> isn't exactly Javascript...
>
> The dream scenario might work as follows. Write programs in Java to
> perform CRUD operations, use Rhino shell to script using CLI programs
> and data objects they create. Today I can get close to that by using
> reflection and a launcher but this solution is fairly cumbersome.
>
> Any help or insight would be appreciated, thanks!
> _______________________________________________
> dev-tech-js-engine-rhino mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
>
>
>
> _______________________________________________
> dev-tech-js-engine-rhino mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
>
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino