A little hard to tell from the code provided, but I think it may have to do with the scope of the method and the way it's being called.  Is it an instance method or a static one?  If it's an instance method, are you sure you're invoking it as such?  Also, there's a typo in the example: substituteTemplate in definition and substituteTemplatey in invocation.  And finally, how are you trying to use the result object?

Greg Allen <GAllen@arrayinc.com> wrote:
I have created a java class that contains a method that returns an array of strings:
    public String[] substituteTemplate (String template, Hashtable subs) throws java.io.IOException, java.io.FileNotFoundException {
            Vector v = new Vector<String>();
        Ö some code here ...
        String[] result = new String[v.size()];
        return result;
I have placed the .jar file containing this class on the classpath and added it to my
beanshell script. I then try to call the method.
            try {
                text = substituteTemplatey(macroFile, vars);
                //Macros.message(view, text.toString());
            } catch (Exception e) {
                Macros.message(view, "Exception");
The method appears to be called OK, but the return value canít seem to be accessed. I get
a silent error and my script just ends. Iíve tried various things but canít seem to access
the returned item.
Is there something special I have to do here? It seems pretty straightforward, but I canít
get it to work.
Any suggestions?
-- Greg
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
Beanshell-users mailing list

2001 Honda CBR600F4i (CCS)
1992 Kawasaki EX500

Ahhh...imagining that irresistible "new car" smell?
Check out new cars at Yahoo! Autos.