importCommands Question

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

importCommands Question

Steve Eckhart
I am attempting to follow the examples in the BeanShell User's Manual. I cannot get the example for Adding BeanShell Commands to work. Here's what I've tried:

1.     Created a file helloWorld.bsh with the helloWorld() command shown in the User's Manual (http://www.beanshell.org/manual/commands.html).

2.     Saved the file in my directory C:\JMeter\jakarta-jmeter-2.3.4\lib.

3.     Executed the commands:

a.     addClassPath("C:\\JMeter\\jakarta-jmeter-2.3.4\\lib");

b.    importCommands("helloWorld.bsh");

c.     helloWorld();
This generates an error:
// Error: EvalError: Command not found: helloWorld() : at Line: 1 : in file: <unknown file> : helloWorld ( )

I've also tried executing importCommands with the full path to helloWorld.bsh.

What am I doing wrong? Thanks,

Steve Eckhart
Business Analyst/Project Manager

WAUSAU Financial Systems
14010 FNB PKWY STE500
Omaha, NE 68154-5206
Main: (402) 431-8810
Direct line: (402) 715-9382
Cellular: (402) 510-5387
Email: [hidden email]<blocked::mailto:[hidden email]>

Enterprise Payment Solutions.
CONFIDENTIALITY NOTICE:  This electronic transmission (including files attached hereto) is intended only for the use of the individual or entity named above.  If the reader of this message is not the intended recipient, you are hereby notified that any disclosure, dissemination, copying, distribution or taking of any action in reliance on the contents of this confidential information is strictly prohibited.  If you have received this communication in error, please destroy it and immediately notify us by return email.  Thank you.
------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
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: importCommands Question

David Lee
You dont import the individual .bsh file you import the entire directory.
Look again at the link you referenced:
http://www.beanshell.org/manual/commands.html

The example is :

addClassPath("/home/pat");  // If it's not already in our classpath
importCommands("/mycommands");

So in your case it would be

  addClassPath("C:\\JMeter\\jakarta-jmeter-2.3.4\\lib");
  importCommands("C:\\JMeter\\jakarta-jmeter-2.3.4\\lib");





-------------------------
David A. Lee
[hidden email]
http://www.calldei.com
http://www.xmlsh.org


On 4/7/2010 11:50 AM, Steve Eckhart wrote:

> I am attempting to follow the examples in the BeanShell User's Manual. I cannot get the example for Adding BeanShell Commands to work. Here's what I've tried:
>
> 1.     Created a file helloWorld.bsh with the helloWorld() command shown in the User's Manual (http://www.beanshell.org/manual/commands.html).
>
> 2.     Saved the file in my directory C:\JMeter\jakarta-jmeter-2.3.4\lib.
>
> 3.     Executed the commands:
>
> a.     addClassPath("C:\\JMeter\\jakarta-jmeter-2.3.4\\lib");
>
> b.    importCommands("helloWorld.bsh");
>
> c.     helloWorld();
> This generates an error:
> // Error: EvalError: Command not found: helloWorld() : at Line: 1 : in file:<unknown file>  : helloWorld ( )
>
> I've also tried executing importCommands with the full path to helloWorld.bsh.
>
> What am I doing wrong? Thanks,
>
> Steve Eckhart
> Business Analyst/Project Manager
>
> WAUSAU Financial Systems
> 14010 FNB PKWY STE500
> Omaha, NE 68154-5206
> Main: (402) 431-8810
> Direct line: (402) 715-9382
> Cellular: (402) 510-5387
> Email: [hidden email]<blocked::mailto:[hidden email]>
>
> Enterprise Payment Solutions.
> CONFIDENTIALITY NOTICE:  This electronic transmission (including files attached hereto) is intended only for the use of the individual or entity named above.  If the reader of this message is not the intended recipient, you are hereby notified that any disclosure, dissemination, copying, distribution or taking of any action in reliance on the contents of this confidential information is strictly prohibited.  If you have received this communication in error, please destroy it and immediately notify us by return email.  Thank you.
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Beanshell-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/beanshell-users
>    

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
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: importCommands Question

Alexey Zinger
In reply to this post by Steve Eckhart
If you look at the documentation in your link, the argument for importCommands command is the "package" of your command.  In your case, it should be "/":

addClassPath("C:\\JMeter\\jakarta-jmeter-2.3.4\\lib");
importCommands("/");

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





________________________________
From: Steve Eckhart <[hidden email]>
To: "[hidden email]" <[hidden email]>
Sent: Wed, April 7, 2010 11:50:30 AM
Subject: [Beanshell-users] importCommands Question

I am attempting to follow the examples in the BeanShell User's Manual. I cannot get the example for Adding BeanShell Commands to work. Here's what I've tried:

1.     Created a file helloWorld.bsh with the helloWorld() command shown in the User's Manual (http://www.beanshell.org/manual/commands.html).

2.     Saved the file in my directory C:\JMeter\jakarta-jmeter-2.3.4\lib.

3.     Executed the commands:

a.     addClassPath("C:\\JMeter\\jakarta-jmeter-2.3.4\\lib");

b.    importCommands("helloWorld.bsh");

c.     helloWorld();
This generates an error:
// Error: EvalError: Command not found: helloWorld() : at Line: 1 : in file: <unknown file> : helloWorld ( )

I've also tried executing importCommands with the full path to helloWorld.bsh.

What am I doing wrong? Thanks,

Steve Eckhart
Business Analyst/Project Manager

WAUSAU Financial Systems
14010 FNB PKWY STE500
Omaha, NE 68154-5206
Main: (402) 431-8810
Direct line: (402) 715-9382
Cellular: (402) 510-5387
Email: [hidden email]<blocked::mailto:[hidden email]>

Enterprise Payment Solutions.
CONFIDENTIALITY NOTICE:  This electronic transmission (including files attached hereto) is intended only for the use of the individual or entity named above.  If the reader of this message is not the intended recipient, you are hereby notified that any disclosure, dissemination, copying, distribution or taking of any action in reliance on the contents of this confidential information is strictly prohibited.  If you have received this communication in error, please destroy it and immediately notify us by return email.  Thank you.
------------------------------------------------------------------------------
Download IntelĀ® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users



     
------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Loading...