I have an application launcher that runs an Ant script that ultimately
runs my application. I'm running Ant directly, i.e.
org.apache.tools.ant.Main. Now I need to add java scripting to my Ant
task, which requires bsf.jar and js.jar. The problem is my application
launcher doesn't include these jars in the classpath when it invokes
Ant. I could resolve that issue, but then all my users would have to
reinstall the application, which is something I would like to avoid.

So my question is, once Ant is up and running, is there any way I can
add these jars to the classpath?

One thing I did try, but didn't work, is:

<taskdef name="javascript"
    classname="org.apache.tools.ant.taskdefs.optional.Script">
  <classpath>
    <fileset dir="${dir.jars}">
      <include name="bsf.jar" />
      <include name="js.jar" />
    </fileset>
  </classpath>
</taskdef>

And then use a <javascript> tag later on in my script. I've tried it
both with and without ant_optional.jar in the classpath. Here's the
error I'm getting:

BUILD FAILED

C:\MOPS\bin\runmops.xml:82: Could not create task of type: javascript
due to java.lang.NoClassDefFoundError: com/ibm/bsf/BSFException
--- Nested Exception ---
java.lang.NoClassDefFoundError: com/ibm/bsf/BSFException
        at java.lang.Class.newInstance0(Native Method)
        at java.lang.Class.newInstance(Class.java:237)
        at org.apache.tools.ant.Project.createTask(Project.java:439)
        at
org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:83)
        at org.apache.tools.ant.Target.execute(Target.java:152)
        at org.apache.tools.ant.Project.runTarget(Project.java:898)
        at org.apache.tools.ant.Project.executeTarget(Project.java:536)
        at
org.apache.tools.ant.Project.executeTargets(Project.java:510)
        at org.apache.tools.ant.Main.runBuild(Main.java:421)
        at org.apache.tools.ant.Main.main(Main.java:149)

Total time: 7 seconds

I'm running Ant 1.3 on Windows NT. Any help is greatly appreciated.

Thanks!

-- Don

__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com

Reply via email to