---
title: "Ant找不到rt.jar"
author: "abingpow"
date: "2014-01-24T11:38:26Z"
tags: []
categories: ["编程语言"]
slug: "ant-rt-jar"
draft: false
lastmod: "2014-01-24T11:38:26Z"
id: 2008807
url: "https://abingpow.iteye.com/blog/2008807"
---

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."

 

所以加上这句 &lt;compilerarg value="-XDignore.symbol.file"/&gt; ：

&lt;javac srcdir="src" destdir="${build.target.dir}/bin" encoding="${sourceEncoding}" source="1.6" target="1.6" debug="true" debuglevel="${debuglevel}" &gt;     
          &lt;classpath refid="aaa.classpath" /&gt;   
          &lt;compilerarg value="-XDignore.symbol.file"/&gt;     
&lt;/javac&gt;

 

转自：[http://hhw3.blog.163.com/blog/static/26909662013010787453/](http://hhw3.blog.163.com/blog/static/26909662013010787453/)