0

I am new to writing ant scripts . I have code in Java 1.4 and when I compile the following ant script

<target depends="init" name="javacompile">
    <javac srcdir="${src}" destdir="${dest}" source="1.4" target="1.4"/>
</target>

I am getting an Unsupported major.minor version 49.0 Exception.

java.lang.UnsupportedClassVersionError: com/sun/tools/javac/Main (Unsupported major.minor version 49.0)

4

1 回答 1

0

The error is saying that your Ant script requires Java 1.4, but you're running JDK 5.0:

These are the mappings to major/minor numbers:

http://en.wikipedia.org/wiki/Java_class_file

J2SE 8 = 52 (0x34 hex),,
J2SE 7 = 51 (0x33 hex),
J2SE 6.0 = 50 (0x32 hex),
J2SE 5.0 = 49 (0x31 hex),
JDK 1.4 = 48 (0x30 hex),
JDK 1.3 = 47 (0x2F hex),
JDK 1.2 = 46 (0x2E hex),
JDK 1.1 = 45 (0x2D hex).

SUGGESTION:

Remove the source="1.4" target="1.4" qualifiers (if possible).

于 2013-07-05T06:39:10.263 回答