When javac is compiling code it doesn't link against rt.jar by default. Instead it uses special symbol file lib/ct.sym with class stubs.
Surprisingly this file contains many but not all of internal sun classes. And the answer is: javac -XDignore.symbol.file. That's what javac uses for compiling rt.jar."
所以加上这句 <compilerarg value="-XDignore.symbol.file"/> :
<javac srcdir="src" destdir="${build.target.dir}/bin" encoding="${sourceEncoding}" source="1.6" target="1.6" debug="true" debuglevel="${debuglevel}" >
<classpath refid="aaa.classpath" />
<compilerarg value="-XDignore.symbol.file"/>
</javac>
转自:http://hhw3.blog.163.com/blog/static/26909662013010787453/