> Subject: RE: Executing javascript ant task with jdk 1.6 > > Here is the output. I have kept bsf.jar in the classpath in ant.sh as > without that I am getting error "java.lang.NoClassDefFoundError: > org/apache/bsf/BSFException". This might be the problem. As far as I know (may the experts step in to correct me), there are various scripting engines, at least BSF (third party component) and javax.script (in 1.6). Adding BSF overrides the JDK 1.6 default of javax.scripting. > Below error is when I have removed "js.jar" from classpath. This > output is with -debug option. > > ===========BEGIN============================== > Adding reference: ant.PropertyHelper > Detected Java version: 1.5 in: /home/java6/jre 1.6 as 1.5? Don't know whether this matters. > Detected OS: HP-UX > Adding reference: ant.ComponentHelper > Setting ro project property: ant.version -> Apache Ant version 1.6.5 > compiled on June 2 2005 There was no 1.6 back then. But 1.6.5 is the latest 1.6. > [echoproperties] ant.java.version=1.5 > BUILD FAILED > java.lang.NoSuchMethodError: > org.mozilla.javascript.Context.getDebuggableEngine()Lorg/mozilla/javascript/debug/DebuggableEngine; > at org.apache.bsf.engines.javascript.JavaScriptEngine.eval(Unknown Source) > at org.apache.bsf.util.BSFEngineImpl.exec(Unknown Source) > at org.apache.bsf.BSFManager$6.run(Unknown Source) > at java.security.AccessController.doPrivileged(Native Method) > at org.apache.bsf.BSFManager.exec(Unknown Source) > at org.apache.tools.ant.util.ScriptRunner.executeScript(ScriptRunner.java:128) > at org.apache.tools.ant.taskdefs.optional.Script.execute(Script.java:60) Might be that either of ant.java.version or the presence of BSF triggers loading of org.mozilla.javascript instead of the Sun version. I think it's BSF. With BSF on Ant's classpath (and also commons-logging, a prerequisite), I'm seeing an exception for the following Ant script: java.lang.NoClassDefFoundError: org/mozilla/javascript/Scriptable Without BSF, it works fine with JDK 1.6 javax.script. I can't see anything in BSF.jar/META-INF that would override some system property defining the scripting engine. I don't even know if there is any such property (as for the XML parser and XSLT processor). So I assume the code trying to load BSF is in Ant 1.6.5, probably in the