How to attach JDK source code in Eclipse?

Posted by Shanky Sohar • August 14, 2011

When we are doing the coding most of the time we need to look at the JVM class but we cann't and need of internet connection arises at that time but it is not always possible to connect to Internet 24x7x365.So here we can save our time by not Googling atleast JVM class included in our JDK kit.We can view the source code directly by clicking on the class.

Confused let us see how

First of all ,you have to download the JDK related source code files unless you already have it.Generally when we downloaded the JDK kit,We already have the source code included in our JDK bundles and it is located in our root Directory.

  • For me it is:-
  • C:\Program Files (x86)\Java\jdk1.6.0_20\src.zip (you will find this src.zip in the root path of your jdk kit directory)
  • Try to "Open Declaration (F3)" to any JVM Class like File, String or any other .you will get source not found message.Like below

Solution is you can either say here.Attach source and pop up like below will be open

Here enter the path of the src.zip of the jdk kit.

Or other way is.

Just say project->properties->Java Build Path->Libraries and expand JRE system library(your Jre version) then rt.jar.Select Source attachment. Click edit.. give the path of your source code file and press OK, Similarly repeat for jsse.jar ,jce.jar, charsets.jar

You can also set this using, Window->Preferences->Java->Installed JRES and click Edit for desired JRE.Expand rt.jar,select Source attachment click edit..and give the path of your source code file and press Ok. Similarly repeat for jsse.jar ,jce.jar, charsets.jar

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值