On Apr 4, 2006, at 1:06 AM, Michelle Le wrote:

To build my code in Java 5, it's required to upgrade JavaCC to
version 4.0. I have downloaded JavaCC source and built the JavaCC.zip file.
I'm having problem when executing javacc from ant build.xml file. ant
is looking for "COM.sun.labs..." when the source that I have built
contains "org.javacc" package name.  "COM.sun.labs" is defined in the
COM_PACKAGE value in the
C:\Apache-Ant-1.6.5\apache-ant-1.6.5\docs\manual\api\constant- values.html#org.apache.tools.ant.taskdefs.optional.javacc.JavaCC.COM_P ACKAGE.
There is also an ORG_PACKAGE_3_1 defined as "org.javacc".
  My questions are:

  1. How do I change my build environment so ant will resolve to the
"org.javacc" package? OR
  2. How do I change the COM_PACKAGE Constant Field Value in ant so I
will resolve with "org.javacc" instead of "COM.sun.labs"?


Are you using the latest version of Ant? I don't recall the specifics, but in Lucene we used to use <java> to launch the JavaCC program, but I switched it back to <javacc> and all has been well with JavaCC 3.2. I have not tried 4.0 though. We define a macro to launch JavaCC - see http://svn.apache.org/repos/asf/lucene/java/trunk/ common-build.xml - like this:

  <macrodef name="invoke-javacc">
    <attribute name="target"/>
    <attribute name="outputDir"/>
    <sequential>
      <mkdir dir="@{outputDir}"/>
      <javacc
          target="@{target}"
          outputDirectory="@{outputDir}"
          debugTokenManager="${javacc.debug.tokenmgr}"
          debugParser="${javacc.debug.parser}"
          debuglookahead="${javacc.debug.lookahead}"
          javacchome="${javacc.home}"
      />
    </sequential>
  </macrodef>

Maybe <javacc> cannot work with JavaCC 4.0 though - its a bit brittle under the covers in this regard, last time I looked.

        Erik



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to