Trivial question about initial script sourced automatically for every JConsole.

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Trivial question about initial script sourced automatically for every JConsole.

Gena Batsyan
Hi everybody!

I've got a small probably trivial problem with beanshell
I'm trying to embed beanshell into my application by doing simple
bsh.Interpreter i = new bsh.Interpreter();
i.eval("desktop()");

what I'm trying to do is to source an initial file into the interpreter
so that the stuff defined therein is available immediately in any shell
created in the desktop, and it just does not work.

I've tried different things
1) before/after evaling desktop() in the code above I tried
i.source("/pathto/boot.bsh");
2) modified makeWorkspace() command in the distribution so that
this.interpreter = new Interpreter( console );
+ this.interpreter.source("/pathto/boot.bsh");

the functions defined in /pathto/boot.bsh are simply not there.
However if i do source("/pathto/boot.bsh"); within the shell (in the
desktop), everything is fine.

It's pretty annoying pasting this every time, I would appreciate if
anyone would have a suggestion...

Thanks in advance!


------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Trivial question about initial script sourced automatically for every JConsole.

Alexey Zinger
You might wanna try something along these lines:


bsh.getNameSpace().importCommands(commandStr);

Here's what seems to be a similar real-world situation to yours.

 Alexey
2001 Honda CBR600F4i (CCS)
1998 Honda RS125 (CCS)
2002 Suzuki Bandit 1200S
http://azinger.blogspot.com
http://bsheet.sourceforge.net
http://wcollage.sourceforge.net





________________________________
From: Gena Batsyan <[hidden email]>
To: [hidden email]
Sent: Mon, March 21, 2011 11:11:04 AM
Subject: [Beanshell-users] Trivial question about initial script sourced
automatically for every JConsole.

Hi everybody!

I've got a small probably trivial problem with beanshell
I'm trying to embed beanshell into my application by doing simple
bsh.Interpreter i = new bsh.Interpreter();
i.eval("desktop()");

what I'm trying to do is to source an initial file into the interpreter
so that the stuff defined therein is available immediately in any shell
created in the desktop, and it just does not work.

I've tried different things
1) before/after evaling desktop() in the code above I tried
i.source("/pathto/boot.bsh");
2) modified makeWorkspace() command in the distribution so that
this.interpreter = new Interpreter( console );
+ this.interpreter.source("/pathto/boot.bsh");

the functions defined in /pathto/boot.bsh are simply not there.
However if i do source("/pathto/boot.bsh"); within the shell (in the
desktop), everything is fine.

It's pretty annoying pasting this every time, I would appreciate if
anyone would have a suggestion...

Thanks in advance!


------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users



     
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Trivial question about initial script sourced automatically for every JConsole.

Alexey Zinger
Looks like the link didn't come through: http://preview.tinyurl.com/4qx875q

 Alexey
2001 Honda CBR600F4i (CCS)
1998 Honda RS125 (CCS)
2002 Suzuki Bandit 1200S
http://azinger.blogspot.com
http://bsheet.sourceforge.net
http://wcollage.sourceforge.net





________________________________
From: Alexey Zinger <[hidden email]>
To: Gena Batsyan <[hidden email]>; [hidden email]
Sent: Mon, March 21, 2011 11:23:19 AM
Subject: Re: [Beanshell-users] Trivial question about initial script sourced
automatically for every JConsole.

You might wanna try something along these lines:


bsh.getNameSpace().importCommands(commandStr);

Here's what seems to be a similar real-world situation to yours.

Alexey
2001 Honda CBR600F4i (CCS)
1998 Honda RS125 (CCS)
2002 Suzuki Bandit 1200S
http://azinger.blogspot.com
http://bsheet.sourceforge.net
http://wcollage.sourceforge.net





________________________________
From: Gena Batsyan <[hidden email]>
To: [hidden email]
Sent: Mon, March 21, 2011 11:11:04 AM
Subject: [Beanshell-users] Trivial question about initial script sourced
automatically for every JConsole.

Hi everybody!

I've got a small probably trivial problem with beanshell
I'm trying to embed beanshell into my application by doing simple
bsh.Interpreter i = new bsh.Interpreter();
i.eval("desktop()");

what I'm trying to do is to source an initial file into the interpreter
so that the stuff defined therein is available immediately in any shell
created in the desktop, and it just does not work.

I've tried different things
1) before/after evaling desktop() in the code above I tried
i.source("/pathto/boot.bsh");
2) modified makeWorkspace() command in the distribution so that
this.interpreter = new Interpreter( console );
+ this.interpreter.source("/pathto/boot.bsh");

the functions defined in /pathto/boot.bsh are simply not there.
However if i do source("/pathto/boot.bsh"); within the shell (in the
desktop), everything is fine.

It's pretty annoying pasting this every time, I would appreciate if
anyone would have a suggestion...

Thanks in advance!


------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users



     
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users



     
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Loading...