Eclipse fix missing java-source-code

After long time... Here is maybe something interesting for you. Sometimes I got the problem to see the java-X-source-code in Eclipse I am not getting it fixed. Now I found a great and easy solution to fix it:

In Eclipse

  1. On Ubuntu install the missing java-sources: apt install openjdk-X-source
  2. Open the preferences Window -> Preferences
  3. Go to: filter: installed jre
  4. Choose and open your Java-Runtime i.e. java-8-openjdk-amd64 -> Edit
  5. Now click on the JRE system libraries-list on the library: .../rt.jar and open it with Source Attachment...
  6. In the Source-Attachmenbt Configuration Window choose External location and navigate to the Path of the in Step-1 installed openjdk-X-source i.e. for java-8 /usr/lib/jvm/java-1.8.0-openjdk-amd64/src.zip

Now you can open any java-class and see the source :)

Hope it helps you a lot like me, have fun!

[1] how-to-install-jdk-sources

This article is my 32nd oldest. It is 132 words long