如何安装JDK源代码?


Answers:


75

Java 8示例:

sudo apt-get install openjdk-8-source

apt-get将其放在相关JDK位置下,即src.zip:/usr/lib/jvm/java-8-openjdk-amd64/src.zip

Intellij IDEA自动识别它并开始向我显示源代码。


13

如果是Java 11(在Ubuntu 18.04上),我这样做了:

首先我安装jdk 11:

sudo apt install openjdk-11-jdk

我安装这样的源:

sudo apt-get install openjdk-11-source

我发现他们在 /usr/lib/jvm/openjdk-11/lib/src.zip

我使用Eclipse,因此进入Eclipse的菜单Window -> Preferences -> Installed JREs 并进入select java-11-openjdk-amd64 -> edit -> select the jar (jrt-fs.jar) -> Source Attachment -> External location -> /usr/lib/jvm/openjdk-11/lib/src.zip

现在,我愉快地阅读了Java文档!:)

祝大家好运!

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.