This article takes the eclipse editor as an example.
1. First, click windows->preference->java->install JARs->select your jre->click Duplicate
2. Find rt.jar and expand it. You will see Soruce attachement:(none). Select it and click Source Attachement on the right...
Free video tutorial sharing:java Free video tutorial
3. In the new window that pops up, select External Location, then click External File.. Find the src in your jdk installation directory. zip, add it in, and then confirm all the way
##dt.jar is a class library about the running environment, rt. jar contains the basic class library of jdk. After doing this, press ctrl "left mouse button" and click on the class, method, etc. you want to view to view the source code. Sometimes it fails because src.zip may not have been added. When performing step 2 again, find rt.jar and expand it. Then you will see Soruce attachement: (none) There is still none in the parentheses. Just try it a few times and it should be fine. Recommended related articles and tutorials:The above is the detailed content of How to view java source code in IDE. For more information, please follow other related articles on the PHP Chinese website!