8

For example, during some compilation errors, I get access to some built in source codes where the error has occured (maybe the perimeters were wrong in main). How can I access those same source codes manually? I am primarily interested in the BigInteger class.

mrahh
  • 281
  • 1
  • 4
  • 13
  • make a breakpoint on the line you want to stop and then debug your application. – Scary Wombat Mar 26 '14 at 08:13
  • Link jdk in eclipse instead of JRE. This will solve your problem. And instead of checking for error in JDK source, try checking your code and find the cause of error there itself. – Yogesh Patil Mar 26 '14 at 08:15

3 Answers3

7

The source code is included in the JDK. There is a src.zip somewhere. You can tell Eclipse to use that file, so you can jump to classes or method declarations even in the standard library.

When you install any JDK, you get src.zip in java/jdk folder. while opening any inbuilt file it will ask you to attach resource. You just need to browse to that location and supply once src.zip. After that when ever you click on java inbuilt class name it will show you the code.

Joey
  • 344,408
  • 85
  • 689
  • 683
3

You can view the source code on the official openjdk site: http://openjdk.java.net/

I always have a copy of whatever jdk I'm working laying around, always nice to check on certain implementations etc.

nablex
  • 4,635
  • 4
  • 36
  • 51
-2

Right-click on the function whose Implementation you want to see, and the from option by right-clicking you can navigate to the internal code for that part. This is for Netbeans, but the process is almost the same for all IDEs. Check the picture below.

Source

enter image description here

Machavity
  • 30,841
  • 27
  • 92
  • 100
Deyaa
  • 21
  • 4