https://issues.apache.org/bugzilla/show_bug.cgi?id=49356

           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
        AssignedTo: notifications@ant.apache.org
        ReportedBy: icey...@yahoo.com


Created an attachment (id=25495)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?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" 
               fork="true"
               source="1.5"
               target="1.5"
               destdir="${build.dir}/classes/<path omitted for IP reasons>" 
               srcdir="${basedir}/src"
               classpathref="pio.classpath">....

I have also attempted this:

    <property name="ant.build.javac.target" value="1.5"/>
    <property name="ant.build.javac.source" 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 (icey...@yahoo.com)

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Reply via email to