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.* ??
-
2Of course, the vast majority of `Object` is `native` functions not in the *Java* source code (but rather the C code of the JVM)... – T.J. Crowder May 13 '12 at 08:51
-
1Possible duplicate: http://stackoverflow.com/questions/2026093/is-jvm-open-source-code-if-not-how-can-i-get-code-of-jvm – Alex K May 14 '12 at 06:52
4 Answers
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.

- 67,591
- 47
- 198
- 287

- 197
- 3
-
I have the java JDK installed I just do not know how to view the code inside of it – sixxvirus May 13 '12 at 09:02
-
If you install an eclipse, the eclipse IDE will help you to find the java source code automatically. – user1112699 May 13 '12 at 09:57
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".

- 30,811
- 12
- 60
- 80
-
1I'd recommend [grepcode](http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/lang/Object.java), it's the sh*t these days. Hyperlinked code, find derived items, find usages, highlight all occurrences in file, ... – Marko Topolnik May 13 '12 at 08:57
-
-
@StephenC that's just a colloquialism, but I guess the standards here frown even upon that. – Marko Topolnik May 13 '12 at 09:00
-
I went on the site, I only see code for java.lang. I do not see the java.net package of the library. – sixxvirus May 13 '12 at 09:06
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

- 2,717
- 1
- 19
- 26
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

- 3,649
- 1
- 17
- 16