1

Is there any web site that I could see the source code for the Java standard library? Most so the two classes java.lang.* and java.net.* ??

2
  • 2
    Of course, the vast majority of Object is native functions not in the Java source code (but rather the C code of the JVM)... Commented May 13, 2012 at 8:51
  • 1
    Possible duplicate: stackoverflow.com/questions/2026093/… Commented May 14, 2012 at 6:52

4 Answers 4

4

Please install Java JDK (Java Developer Kit), which is not the same as Java JRE (Java Runtime Environment).

The Java JDK contains the Java source code.

And you'd better to use an IDE (Integrated Development Environment) such as Eclipse or NetBeans to develop Java programs.

You can look for the java code via the IDE tool.

Sign up to request clarification or add additional context in comments.

2 Comments

I have the java JDK installed I just do not know how to view the code inside of it
If you install an eclipse, the eclipse IDE will help you to find the java source code automatically.
3

Of course. You could find it in the JDK, but also online. I also use the online version, because I find it faster as to open the folder with the JDK, brows through all the files and so on. Just google "java source object".

http://www.docjar.com/html/api/java/lang/Object.java.html

4 Comments

I'd recommend grepcode, it's the sh*t these days. Hyperlinked code, find derived items, find usages, highlight all occurrences in file, ...
@Marko Topolnik nice site! It is even with FindBugs annotations!
@StephenC that's just a colloquialism, but I guess the standards here frown even upon that.
I went on the site, I only see code for java.lang. I do not see the java.net package of the library.
1

You need the JDK (JAVA SDK) installed and source of class library is at (on Windows):

C:\<Program Files>\Java\<JDK>\src.zip

Like

C:\Program Files\Java\jdk1.7.0\src.zip

1 Comment

I think src.zip should be in the JDK folder in MAC as well.
0

Java source code is available in JDK distribution. If you have installed JDK on your machine, in JDK directory you'll find src.zip. For example, in my windows machine source code is available at: C:\Program Files\Java\jdk1.6.0_12.

Alternatively, you can find Java source code online at: Java Source Code

Thanks, Mrityunjoy

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.