Reputation: 3993
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.
Upvotes: 18
Views: 8625
Reputation:
In Linux:
Click "AttachSource" ,then select External file location.
Path:- Go to Computer-> usr-> lib-> jvm-> openjdk-8 ->src.zip
If you do not find openjdk-8 folder. You need to install it.
In Terminal type:-
1) java -version :Check your java version. (If jdk version is other than 8 change to the appropriate number)
2)sudo apt-get install openjdk-8-doc : it is for installing documentation.
3)sudo apt-get install openjdk-8-source : it is for installing source file.
Source:- Bipin Bharathi YoutubeChannel(Check out his video(Recommended))
https://www.youtube.com/watch?v=X_NocC2TO2E
Upvotes: 0
Reputation: 4078
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.
Upvotes: 28
Reputation: 1582
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
Upvotes: 9
Reputation: 97
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.
Upvotes: 6