Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to know where are the java API's stored. I use openJDK 7. I want to edit some of the code of a class to suit my needs and therefore I want to know where are these API's stored. Can anyone please answer this question?

share|improve this question
1  
So you're looking for the source code, not the API documentation? Wouldn't it make more sense to just extend the class in question? –  geirha Jun 30 '12 at 8:03
    
I want to change the source code only .... i know to extend but i want to change the source code –  Pranit Bauva Jun 30 '12 at 8:05
1  
Do not edit code in the Java API - it will make your installation non-standard. Instead learn how to create subclasses and override the methods you want. –  Thorbjørn Ravn Andersen Jun 30 '12 at 9:37
add comment

1 Answer

up vote 2 down vote accepted

To get the source code, run (as a regular user, not root)

apt-get source openjdk-7-jre

It will download the source tree used to generate all the openjdk-7 packages. It downloads it to your current directory, so you may want to run something like mkdir -p ~/src && cd ~/src first.

The compressed archive jdk-dfsg.tar.gz at the root of the source tree appears to contain all the standard classes.

You might need to enable source code repositories:

share|improve this answer
    
its coming as "E: You must put some 'source' URIs in your sources.list" Can you please suggest some links ?? –  Pranit Bauva Jun 30 '12 at 9:45
    
@PranitBauva make sure each deb-line in /etc/apt/sources.list also has an identical (apart from the first word) deb-src-line. By default, all the standard repositories should have this, so I'm guessing you've modified your /etc/apt/sources.list at some point. –  geirha Jun 30 '12 at 10:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.