Lately I've been trying to get the Eclipse JavaCC plugin to work on my Mac 10.5.6 laptop with Eclipse 3.4.2. I was having all sorts of problems... basically the ones which folks are discussing here. After fiddling around a bit I ended up checking out the plugin and rebuilding the plugin.jar file using Java 1.5 and that did the trick. So, to get the Eclipse JavaCC plugin v1.5.13 working, try this:
- Install the JavaCC plugin using the instructions outlined here.
- Download this new plugin.jar file.
- Shut down Eclipse and copy the plugin.jar file into the plugin directory. On my Mac I've got Eclipse installed in /Users/tom/eclipse, so I copied the jar file to /Users/tom/eclipse/plugins/sf.eclipse.javacc_1.5.13/plugin.jar
- Restart Eclipse and create a new grammar file (File => New => Java Project, File => New => File, name it foo.jj)
- Paste in some boilerplace JavaCC grammar contents, e.g.:
options {
JDK_VERSION="1.5";
}
PARSER_BEGIN(Foo)
public class Foo {}
PARSER_END(Foo)
TOKEN : {
<HI : "hello">
}
void Foo() : {} {
<HI>
}
Hopefully that helps someone. And if you're working with JavaCC, check out my JavaCC book!
hi, i'm tried your jar file and it recognize the javacc file fine but I don't see any other option. for instance the option to create new javacc file (as outlined in http://eclipse-javacc.sourceforge.net/) is not there. is this supposed to be like this? or am i missing some steps?
btw, i have
eclipse 3.4.2
osx 10.5.6
java 1.5.0_16
javacc feature 1.5.13
Posted by: sang park | April 15, 2009 at 01:34 PM
Works great! All options seem to be available and working, even those Sang Park missed.
Posted by: Tommy | April 20, 2009 at 11:10 AM
I have the same configuration and the plugin.jar works well.
But there is no jjtree nor javacc compilation when I save a jjtree file.
I fill all necessary fields in the javaCC properties panel.
any suggestion ?
Regards.
Posted by: manu | April 22, 2009 at 10:34 AM
@sang - yeah, I think that feature was removed in v1.5.13 of the plugin since Remy was trying to get it working in all versions of Eclipse.
@manu - hm, I haven't tried that... let me look into that.
Posted by: tomcopeland | April 23, 2009 at 11:50 AM
Thanks it works fine for me now
Posted by: oli | June 17, 2009 at 05:46 AM