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
