I have installed OpenJDK 7 and it runs well on my Ubuntu 14.04 machine. I want to add Java sources to my Eclipse. When I go to /usr/lib/jvm/java-7-openjdk-amd64
there is a symlink called src.zip
but it's broken. How do I fix this? Do I have to manually download sources and add them?
The answer from Alex is correct, as in how it should be. However, for OpenJDK 11 on Ubuntu 18.10 it appears that src.zip has been moved to lib/src.zip so the symlink cannot be resolved.
In addition to the
sudo apt install openjdk-11-source
command, run
echo "(cd /usr/lib/jvm/openjdk-11/; ln -s lib/src.zip)" | sudo bash
to create an additional symbolic link.
You should do:
sudo apt-get install openjdk-7-source
then the source code will be downloaded under: "/usr/lib/jvm/openjdk-7". The symlink:
src.zip -> ../openjdk-7/src.zip
should work now.
I downloaded sources from http://jdk7src.sourceforge.net/ and added them to eclilpse. It works fine now.
installing openjdk8 again worked for me in ubuntu 16.04
step1: sudo apt install openjdk-8-source
step2 : attach the source.zip under(Window->preferences-java->Installed JREs->edit java-8-open-Jdk->expand rt.jar->click on Source attachment and attach the src.zip under /usr/lib/jvm/java-8-openjdk-amd64).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With