[antlr-interest] ANTLR3 ant task class file problem

Travis Caldwell travis_caldwell2000 at yahoo.com
Tue May 15 23:45:16 PDT 2007


 Hi, 

 I was attempting to use the ANTLR3 ant task that was uploaded to the
file sharing site and I get the following error:

 BUILD FAILED
java.lang.UnsupportedClassVersionError: Bad version number in .class
file

 Googling this list I see that someone previously had the same issue:

> [antlr-interest] comments on ant task for v3..
> Eitan Suez eitan.suez at gmail.com
> Thu Feb 8 14:14:53 PST 2007
[...]
> 5. the ant task appears to be built with java 6.
>  i tried to run a test target and am getting this:
> BUILD FAILED
> java.lang.UnsupportedClassVersionError: Bad version number in .class 
file

 It also looks like there was an attempt to solve this here:

> [antlr-interest] updated antlr3 ANT task
>Terence Parr parrt at cs.usfca.edu
>Sat Feb 10 16:08:49 PST 2007
[...]
>       Compiled the antlr3 taks with -source 5 for compatibility  
with Java 5.

 I checked the zip that I downloaded and I definitely have the new
version since the readme in the zip also refers to being compiled with
"-source 5". It also includes the simplecTreeParser example refered to
in the email about the new version.

The class file looks to like it was built for java 6: 

$ od -tx1 ANTLR3.class | head
0000000 ca fe ba be 00 00 00 32 02 0d 0a 00 ae 01 05 07
                             ^^
The major number is 50 decimal which according to this:


http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.jdt.doc.isv/guide/jdt_api_compile.htm

Indicates a Java 6 class file.

 Perhaps the compile should be done with "-source 5 -target 5" in order
to be compatible with both java 5 & 6.

 I think that "-source 5" may only instruct the compiler to expcet java
5 source, but it will still emit java 6 class files.

 Thanks.

                  _Travis_Caldwell_






       
____________________________________________________________________________________
Moody friends. Drama queens. Your life? Nope! - their life, your story. Play Sims Stories at Yahoo! Games.
http://sims.yahoo.com/  


More information about the antlr-interest mailing list