tags:

views:

52

answers:

1

Hello,

i wanted to use my java code as beanshell script but beanshell throws Exception saying class not found in namespace. Isn't there inner class in beanshell or does it have any other usage?

my script looks like here:

.......
.......
java code
.......
.......
MyClass m = new MyClass(); //Error here: MyClass not fount in namespace



class MyClass {

}

i use the inner class in script, which i declare in the script.

Thanks, Bilal

A: 

Maybe a silly answer here but could it be that the MyClass definition needs to be above its usage in the file? Doesn't bean shell process scripts linearly?

A quick look in the docs doesn't spell this out but tests of the following script certainly works fine for me:

class MyClass {
}
MyClass m = new MyClass(); //Error here: MyClass not fount in namespace
Gray
it didn't work. i have found another way without using inner class. but this is 2. time that i ran away from inner class. i have read many times that beanshell accepts inner class but it never worked for me.
bilal