I can't seem to import the commands from one Beanshell script to another. I keep getting "Error in script callingScript Command not found: helloWorld()"
Here's my calling script:
// c:/myProjectDir/bsh/callingScript.bsh
...
addClassPath("/bsh"); // My default directory is myProjectDir
importCommands("utils");
helloWorld();
And my called script:
// c:/myProjectDir/bsh/utils/HelloWorld.bsh
helloWorld() {
System.out.println("Hello World!");
}
When I print out the classpath right before running importCommands I get:
Classpath:
... (random jars)
file:/C:/myProjectDir/bsh/
I've seen beanshell documentation and other resources that all show something like this and seem to work. I just can't figure out what I'm doing differently (read: wrong) which is preventing the import from happening.
Thanks!
The issue was that I didn't have a method within the classes that I was trying to import that were the same as my file names.
So in the example in the question, I had a file named "HelloWorld.bsh" and a method named "helloWorld()". Simply renaming the method to "HelloWorld()" (capitalized to match filename) fixed the issue.