[antlr-interest] Anyone running ANTLR with Netbeans?
Jim Idle
jimi at temporal-wave.com
Thu Jul 3 13:38:28 PDT 2008
On Thu, 2008-07-03 at 16:20 -0400, Edwards, Waverly wrote:
> Using Netbeans 5.5.1 and 6.0.1 I've added the lib folder to the
> classpath.
>
> The error message is "package org.antlr.runtime does not exist"
>
> I've looked through the source code that I downloaded and I can find
> the different folders/packages so I also tried adding the source folder
> to just the project but this didn't work.
>
> What IDE's are others using and is it as simple as adding the lib folder
> to
> the classpath as I read on the wiki?
I use Netbeans and have posted how to configure it on this list in the
past. You should be able to search and find it.
However, in a nutshell:
1) Install the antlr3 ant task (see downloads) in to the dir: C:\Program
Files\NetBeans 6.1\java2\ant\lib
2) Create a new project
3) Right click on libraries, add library, create, create a library
called ANTLR3 (or whatever), then add the Jars (and docs and source is
even better) to this library definition. In future you can just add the
library.
4) Add a .g file
5) Open the build.xml for your project
6) Add some property defs and a -pre-compile task (there are other ways
but this is easy), as per the antlr3 ant task docs.
7) Right click project and build
build.xml will look something like this:
<property name="grammar.dir"
location="src/com/temporalwave/parsers/tsql/" />
<property name="antlr.libdir" location="C:/antlrsrc/lib" />
<property name="antlr.tooldir" location="C:/antlrsrc/lib" />
<property name="antlr.runtimedir" location="C:/antlrsrc/lib" />
<patternset id="antlr.libs">
<include name="stringtemplate-3.1.jar" />
<include name="antlr277.jar" />
</patternset>
<patternset id="antlr.tool">
<include name="ANTLRTool.jar" />
</patternset>
<patternset id="antlr.runtime">
<include name="ANTLRRuntime.jar" />
</patternset>
<path id="antlr.path">
<fileset dir="${antlr.tooldir}" casesensitive="yes">
<patternset refid="antlr.tool" />
</fileset>
<fileset dir="${antlr.runtimedir}" casesensitive="yes">
<patternset refid="antlr.runtime" />
</fileset>
<fileset dir="${antlr.libdir}" casesensitive="yes">
<patternset refid="antlr.libs" />
</fileset>
</path>
<target name="-pre-compile">
<antlr:antlr3 xmlns:antlr="antlib:org/apache/tools/ant/antlr"
target="${grammar.dir}/tsqllexer.g"
depend="true">
<classpath>
<path refid="antlr.path" />
</classpath>
</antlr:antlr3>
<antlr:antlr3 xmlns:antlr="antlib:org/apache/tools/ant/antlr"
target="${grammar.dir}/tsql.g"
depend="true" >
<classpath>
<path refid="antlr.path" />
</classpath>
</antlr:antlr3>
<antlr:antlr3
xmlns:antlr="antlib:org/apache/tools/ant/antlr"
target="${grammar.dir}/tsqlwalker.g"
depend="true" >
<classpath>
<path refid="antlr.path" />
</classpath>
</antlr:antlr3>
</target>
Jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080703/db56d969/attachment.html
More information about the antlr-interest
mailing list