Question From a New Beanshell User ("Command Not Found Error")

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

Question From a New Beanshell User ("Command Not Found Error")

Redefined Horizons
I recently bought the O'reilly book "Learning Java" and I have gotten
hooked on Beanshell as a result. (I've been programming in Java for a
couple of years.)

I tried to start using Beanshell with some of my own classes today,
but i've run into trouble. I was hoping I might get some suggestions
on how to correct my mistake.

I've got a Jar file with a class named WholeNumberPart. I add the Jar
file to my classpath in beanshell using the addClassPath command. I
then use the "import *" command.

The WholeNumberPart class defines a single constructor which accepts a
String as its only parameter. When I try to run the following line in
the Beanshell console:

test = WholeNumberPart( "22323332" );

I get this error message:

// Error: EvalError: Command not found: WholeNumberPart(
java.lang.String ) : at Line: 1 : in file: <unknown file> :
WholeNumberPart ( "2235226" )

It seems like Beanshell can't find my constructor. I'm not sure how to
fix this. (I know the constructor is defined in the class file, and I
get no compile erros.)

I must be missing something obvious.

Thanks,

Scott Huey

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

Re: Question From a New Beanshell User ("Command NotFound Error")

David Lee
try this instead. you were not calling a constructor, but rather a global
function.


-------------------

test = new WholeNumberPart( "22323332" );

----------------------

----- Original Message -----
From: "Redefined Horizons" <[hidden email]>
To: <[hidden email]>
Sent: Tuesday, October 16, 2007 11:38 AM
Subject: [Beanshell-users] Question From a New Beanshell User ("Command
NotFound Error")


>I recently bought the O'reilly book "Learning Java" and I have gotten
> hooked on Beanshell as a result. (I've been programming in Java for a
> couple of years.)
>
> I tried to start using Beanshell with some of my own classes today,
> but i've run into trouble. I was hoping I might get some suggestions
> on how to correct my mistake.
>
> I've got a Jar file with a class named WholeNumberPart. I add the Jar
> file to my classpath in beanshell using the addClassPath command. I
> then use the "import *" command.
>
> The WholeNumberPart class defines a single constructor which accepts a
> String as its only parameter. When I try to run the following line in
> the Beanshell console:
>
> test = WholeNumberPart( "22323332" );
>
> I get this error message:
>
> // Error: EvalError: Command not found: WholeNumberPart(
> java.lang.String ) : at Line: 1 : in file: <unknown file> :
> WholeNumberPart ( "2235226" )
>
> It seems like Beanshell can't find my constructor. I'm not sure how to
> fix this. (I know the constructor is defined in the class file, and I
> get no compile erros.)
>
> I must be missing something obvious.
>
> Thanks,
>
> Scott Huey
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Beanshell-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/beanshell-users
>


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

Re: Question From a New Beanshell User ("Command Not Found Error")

Travis Bulford
In reply to this post by Redefined Horizons
Um I am not 100% sure but should it not read

test = new WholeNumberPart( "22323332" );

Regards
Travis


On 10/16/07, Redefined Horizons <[hidden email]> wrote:
I recently bought the O'reilly book "Learning Java" and I have gotten
hooked on Beanshell as a result. (I've been programming in Java for a
couple of years.)

I tried to start using Beanshell with some of my own classes today,
but i've run into trouble. I was hoping I might get some suggestions
on how to correct my mistake.

I've got a Jar file with a class named WholeNumberPart. I add the Jar
file to my classpath in beanshell using the addClassPath command. I
then use the "import *" command.

The WholeNumberPart class defines a single constructor which accepts a
String as its only parameter. When I try to run the following line in
the Beanshell console:

test = WholeNumberPart( "22323332" );

I get this error message:

// Error: EvalError: Command not found: WholeNumberPart(
java.lang.String ) : at Line: 1 : in file: <unknown file> :
WholeNumberPart ( "2235226" )

It seems like Beanshell can't find my constructor. I'm not sure how to
fix this. (I know the constructor is defined in the class file, and I
get no compile erros.)

I must be missing something obvious.

Thanks,

Scott Huey

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users



--
www.toxicbunny.co.za << Java port site
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users