How to see the source code for java SDK (java.lang, java.util, …) classes in Eclipse?

前端 未结 4 474
死守一世寂寞
死守一世寂寞 2021-01-24 05:07

I want to read jar class files into my eclipse. Suppose I wrote the following code:

List list = new ArrayList();

When I ctrl click on List, it

4条回答
  •  失恋的感觉
    2021-01-24 05:46

    In order to see the source codes of JDK in eclipse you should add JDK path instead of JRE to your workspace or for a specific project SDK. I assume you are a developer and you've installed JDK on your system.

    To do that:

    1. Right click and select Properties (or press Alt+Enter) on your project.
    2. From the left tree styled menu select Java Build Path
    3. On the right select the Libraries
    4. Select the JRE System Library

    1. From the right side buttons click on edit, and edit the path from JRE location to points to the JDK location in your file system.

    1. Then click on Finish and the OK buttons of all opened dialogs to save the configurations and you set to go.

    Hope this would be helpful.

提交回复
热议问题