Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get the Java API sources? [closed]

While there seems to be a way to clone the whole repo, described here, I just need just the Java API files, nothing more. (Hint: traffic limit + slow connection)

Now, here is the whole git repo, but where are the plain Java API files? Or are they at a complete different location? Someone an idea? I'm not that much a git expert.

like image 448
java.is.for.desktop Avatar asked Jun 11 '11 22:06

java.is.for.desktop


People also ask

Where is Java API located?

You can find it in the src. zip in the JDK installation directory. Your IDE may also provide a Go to reference command that let you access the source code in src. zip when you use it on a method of the Java class library.

How do you release a resource in Java?

Java automates the reclamation of memory, but not other resources. A finalize() method can help ensure that resources are released eventually but not in a timely fashion. It appears that this has been handled ad-hoc in various Java classes -- some have close(), some dispose(), some destroy(), and probably others.

Which language feature ensures that objects implementing the AutoCloseable interface are closed?

The try -with-resources statement ensures that each resource is closed at the end of the statement. Any object that implements java. lang. AutoCloseable , which includes all objects which implement java.


2 Answers

I have no idea what you think "the plain Java API files" are.

The second link is not a git repo. It is a family of git repositories. Each row in that table is one git repo. The first link is for instructions on how to use Android-supplied tools to clone all of those repositories.

If you think "the plain Java API files" refer to the java.* and javax.* classes, they are from the libcore repo.

If you think "the plain Java API files" refer to android.* classes, they are from the frameworks/base repo.

Other repos may be contribute other portions of "the plain Java API files", such as Apache HttpClient.

If all you are trying to do is poke through the code, I recommend Google Code Search. For example, I refer to the Android source code frequently, and I don't have it downloaded.

[Edit] And if all you want to do is develop android applications, you don't need any of this; just download the SDK

like image 135
CommonsWare Avatar answered Oct 06 '22 10:10

CommonsWare


Following worked, with the help of this question:

git clone git://android.git.kernel.org/platform/frameworks/base.git
cd base
git tag -l
git checkout android-2.2.2_r1

And then we get a nice directory: core/java/android

tar cjf android-java-2.2.2.tbz2 core/java/android

And then we get a nice bzip2-ed archive: android-java-2.2.2.tbz2, just 1.8MB ;)

like image 27
java.is.for.desktop Avatar answered Oct 06 '22 10:10

java.is.for.desktop