I have a debian machine. I am using eclipse. Normally on eclipse, to view the source of code of an object, etc, you simply click F3
on the object. But for some reason, when it's core java classes, I get
"Source not found" and an option to attach the source.
Where exactly is the JRE source on debian? When I do a aptitude search "?provides(java-runtime)"
, the result contains multiple answers with the substring jre
in it and also no path.
Can someone tell me exactly where to get the source so I can attach it. Also, I would like to make it available to all projects, not just per project.
Go to Windows->Preferences->Java->Installed JREs. Select Browse and navigate to the C:\Program Files\Java\jdk1. 6.0_21 directory. Eclipse will automatically find the source and associate it with the JDK classes.
Clicking anywhere on the class name that we want to open and pressing F3. Clicking anywhere on the class name and going to the menu under Navigate > Open Declaration.
The JRE
is purely the runtime environment needed to run Java programs. For the development of Java programs, you need the JDK
(Java Development Kit).
The JDK itself is split up into several packages, including the JRE, documentation, demos, and the source files.
Assuming that you're using Open JDK 6, sudo apt install openjdk-6-source
would install and link the source code that you're looking for.
This worked for me in Ubuntu 14.10, Eclipse Kepler using openjdk-8
Window > Preferences > Java > Installed JREs > Click on your java-8-openjdk > Edit
For /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/rt.jar:
set Source attachment to:
/usr/lib/jvm/java-8-openjdk-amd64/src.zip
set Javadoc location to:
file:/usr/share/doc/openjdk-8-doc/api/
NOTE: If you don't already have the openjdk-8 java doc, install:
sudo apt-get install openjdk-8-doc
and for the source:
sudo apt-get install openjdk-8-source
sudo apt-get intall java-6-openjdk was successful for me on Ubuntu 11.04 LTS. Additionally,if you are using the Eclipse IDE, I went through Window/Preferences/InstalledJREs/java-6-openjdk-amd64/Edit(find rt.jar ) and then Add External File src.zip as shown in the screen shot.
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