Ant javac problem

ant

compiling with javac ant task giving me errors that doesn't exists..
[javac] D:\mySrc\xx.java:1: illegal character: \65279
[javac] package com.x.y;

and there is no problem with the class xx.java

here is my compile target:

<javac srcdir="${src}/src" destdir="${bin}" encoding = "utf-8" classpathref="classpath" debug="true" debuglevel="lines,vars,source" deprecation="off" />
     <copy todir="${bin}" overwrite="no">
    <fileset dir="${src}/src" excludes="**/*.java"/>                                    
    </copy>

Best Solution

The issue is probably with the Byte Order Mark (the thing that looks like: ""). These three special characters at the beginning of the file indicate that the file is in UTF-8 encoding. I've seen a few cases where the Java tools don't deal with this very well. See if you can delete this from your file, or setup your editor to not insert this BOM in the file.

Here's a good thread on this topic:

http://groups.google.com/group/comp.lang.java.programmer/browse_frm/thread/adb0500c61451317?pli=1

Try searching google for "javac illegal character \65279". This should give you some additional resources.