日期:2014-05-20  浏览次数:20676 次

The source attachment doesnot contain the source for the file TrueTypeFont.class

如图,我在第11行设置了一个断点,点击“Debug as Java application”,程序可以停到断点处(第11行),再点击F6,希望跳第12行,但出现如下错误:

最主要的是The source attachment does not contain the source for the file TrueTypeFont.class.这句提示,我在src/com/sun中的确没有找到TrueTypeFont.java

点击Change Attached Source出现下图
http://hi.csdn.net/attachment/201111/14/11378_13212761855I3v.png

这是源代码的文件夹,改了就全错了。
哪位朋友知道如何解决The source attachment does not contain the source for the file TrueTypeFont.class,给我说下,万分感谢。

------解决方案--------------------
http://download.java.net/jdk6/source/
下载jdk的源代码,然后运行那个jar安装,之后你要的sun.font.TrueTypeFont.java
在src\share\classes\sun\font文件夹下
------解决方案--------------------
导入的包不全吧
jre路径下的lib下的rt.jar就包含有这个sun.font.TrueTypeFont.class
估计是LZ的eclipse选的jdk版本不对,LZ查看一下选用的jdk,或者手动导入rt.jar包试试看