Eclipse查看JDK/JRE/Android源码
- 为所有工程设置JRE源码:Preference / Java / Installed JREs
- 双击右侧的jre,展开xxx\rt.jar,点击Source Attachment。
- External location,填入随jdk安装的zip源码路径,例如 _C:/Program Files (x86)/Java/jdk1.7.025/src.zip。
- PS:javadoc不用设置,用默认在线的即可。
为单个工程设置JRE/JDK/Android源码:
- 工程属性 / Java Build Path / Libraries
- JRE System Library / rt.jar / Source attachment / Edit / External location
- 填入随jdk安装的zip源码路径,例如 _C:/Program Files (x86)/Java/jdk1.7.025/src.zip。
- Android x.x.x / android.jar / Source attachment / Edit / External location
- Android源码14+可以直接通过sdk下载,参考解决Android SDK Manager下载慢的问题。
- 其他版本可以通过 grepcode 下载
- 也可以使用git clone对应版本的源码,参考文章。
如:git clone https://android.googlesource.com/platform/frameworks/base android-2.3.4_r1
FAQ
Linked Resources
See eclipse - Is there a way to setup Linked Resources relative to the .project file? - Stack Overflow
Eclipse自动刷新工程(适合嵌入web开发)
Window / Preferences / General / Workspace Refresh using native hooks or polling = true Refresh on access = true
Eclipse 自动保存
Windows-> preferences->run/debug>launching->save required dirty editors before launching Windows-> preferences->General->Workspace->save automatically before build