Beanshell in Ant yielding, "Unable to create javax script engine for beanshell"

Vimes picture Vimes · Apr 26, 2010 · Viewed 12.1k times · Source

Greeting, I'm trying to put some Beanshell script in my Ant build.xml file. I've followed the Ant manual as well as I can but I keep getting "Unable to create javax script engine for beanshell" when I run Ant. Here is the test target I wrote mostly from examples in the Ant manual:

<target name="test-target">
    <script language="beanshell" setbeans="true">
        <classpath>
            <fileset dir="c:\TEMP" includes="*.jar" />
        </classpath>
        System.out.println("Hello world");
    </script>
</target>

My beanshell "bsh-2.0b4.jar" file is on the script task's classpath the way the manual recommended. Hope I have the right file. I'm working in c:\TEMP right now. I've been googling and trying for a while now. Any ideas would be greatly appreciated. Thanks.

Answer

Brett Kail picture Brett Kail · Apr 27, 2010

First, you need jsr-engines.zip from here:

https://scripting.dev.java.net/servlets/ProjectDocumentList

Inside, you'll find jsr223/beanshell/build/bsh-engine.jar. Some searching implied that you need to download bsh-2.05b.jar. I found it here:

http://beanshell.org/bsh-2.0b5.jar

The more easily findable bsh-2.0b4.jar also seemed to work, but it printed a message that implied it was experimental.