ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 49356] New: javac task is ignoring source and target
Date Sat, 29 May 2010 00:10:29 GMT

           Summary: javac task is ignoring source and target
           Product: Ant
           Version: 1.8.1
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: Core tasks

Created an attachment (id=25495)
 --> (
Screen shot of a "good" and "broken" class that caused the exception.  The
difference is in the major version.  The code is identical.

It appears that the javac target is ignoring the "source" and "target" options
that control which version of class files should be produced.  I hope that I am
wrong on this one, so I will attach the info that I have seen....

I used both ant 1.7.x and 1.8.x in witnessing the issue.

We are currently running java 1.5.xx in production, but developing with 1.6. 
Hence, we are compiling to the class level using the following syntax in our
ant scripts:

       <javac debug="on" 
               destdir="${build.dir}/classes/<path omitted for IP reasons>" 

I have also attempted this:

    <property name="" value="1.5"/>
    <property name="" value="1.5"/>

...with the same results, that is, we get this error:

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

We only get this error when building with ant.  I verified that a command-line
javac command, run from the jdk1.6 installation from Sun, using "-source 1.5
-target 1.5", produces a class having the major version "49", whereas the ant
task javac with the same settings produces a class with the major version "50"
on the same code - which, I assume (and I may be wrong) is at the heart of it. 
I made a composite screenshot out of it which I will attach to this message.

Any insight is most welcome.

Best Regards,

Cory (

Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.

View raw message