本文介绍了如何在Eclipse中查看java SDK(java.lang,java.util,...)类的源代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想把jar类文件读入我的eclipse。假设我编写了以下代码:

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

List list = new ArrayList();

当我按住Ctrl键时,它会显示两个选项。其中一个选项是Open Declaration,它将显示List接口中的方法。但当我点击它时,它显示未找到源。我已经添加了 java-util-1.8.0.jar ,但它仍然不起作用。
我做错了什么?

When I ctrl click on List, it shows two options. One of the option is Open Declaration which will show the methods in List interfaces. But when I click it it shows source not found. I've added java-util-1.8.0.jar to it but still it won't work.What am I doing wrong?

推荐答案

为了查看 JDK的源代码在eclipse中你应该将 JDK 路径而不是 JRE 添加到你的工作区或特定的项目SDK。我假设您是开发人员,并且已在系统上安装 JDK

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.

要做到这一点:


  1. 右键单击并在项目中选择属性(或按 + )。

  2. 从左侧树状菜单中选择 Java构建路径

  3. 在右侧选择

  4. 选择 JRE系统库

  1. Right click and select Properties (or press +) 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. 从右侧按钮单击编辑,然后编辑路径从 JRE 位置指向文件系统中的 JDK 位置。

  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. 然后点击完成和所有打开的对话框的OK按钮保存配置,然后设置为。

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

希望这会有所帮助。

这篇关于如何在Eclipse中查看java SDK(java.lang,java.util,...)类的源代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 10:15