9 Replies - 1940 Views - Last Post: 11 November 2009 - 09:43 AM

#1 333OnlyHalfEvil  Icon User is offline

  • D.I.C Addict

Reputation: 24
  • View blog
  • Posts: 664
  • Joined: 20-March 09

Java API Source Code

Posted 18 June 2009 - 10:59 AM

Why doesn't Sun Microsystems have the source code in the Java API? Is there a website that has it?

This post has been edited by 333OnlyHalfEvil: 18 June 2009 - 10:59 AM

Is This A Good Question/Topic? 0
  • +

Replies To: Java API Source Code

#2 Locke  Icon User is offline

  • Sarcasm Extraordinaire!
  • member icon

Reputation: 520
  • View blog
  • Posts: 5,596
  • Joined: 20-March 08

Re: Java API Source Code

Posted 18 June 2009 - 11:33 AM

When you install the JDK, there is a folder, probably in your Program Files directory (if you're using Windows), called Java. In the Java directory, there will probably be a folder. (possibly more if you have upgraded) That folder will probably start with something along the lines of jdk1.X.X_XX. If you go into that folder...there will be a zipped folder called src. Unzip it somewhere, I kept it in the same jdk1.X.X_XX folder, but created a SOURCE folder. Then you can look at the source code for all of the standard Java classes. ;)

Hope this helps! :)
Was This Post Helpful? 1
  • +
  • -

#3 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3093
  • View blog
  • Posts: 19,139
  • Joined: 14-September 07

Re: Java API Source Code

Posted 18 June 2009 - 11:35 AM

It's a lot of fun to dig around in there.
Was This Post Helpful? 0
  • +
  • -

#4 nick2price  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 561
  • View blog
  • Posts: 2,826
  • Joined: 23-November 07

Re: Java API Source Code

Posted 18 June 2009 - 01:55 PM

Or you can do it the easy way. Go to THIS website and type in whatever java class you want the source for.Just make sure you choose java package/class name
Was This Post Helpful? 1
  • +
  • -

#5 Locke  Icon User is offline

  • Sarcasm Extraordinaire!
  • member icon

Reputation: 520
  • View blog
  • Posts: 5,596
  • Joined: 20-March 08

Re: Java API Source Code

Posted 18 June 2009 - 03:39 PM

View PostKYA, on 18 Jun, 2009 - 12:35 PM, said:

It's a lot of fun to dig around in there.


That quote...yeah...that's what she said. </off-topic> :lol:

I know, right? One day, I was just wondering if I could get the source code somehow...so I did a little searching and found that all the classes are there, but you just have to unpack 'em. :D </on-topic>

This post has been edited by Locke: 18 June 2009 - 03:43 PM

Was This Post Helpful? 0
  • +
  • -

#6 333OnlyHalfEvil  Icon User is offline

  • D.I.C Addict

Reputation: 24
  • View blog
  • Posts: 664
  • Joined: 20-March 09

Re: Java API Source Code

Posted 18 June 2009 - 03:42 PM

Thanks, that helps out a lot.
Was This Post Helpful? 0
  • +
  • -

#7 NickDMax  Icon User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2250
  • View blog
  • Posts: 9,245
  • Joined: 18-February 07

Re: Java API Source Code

Posted 25 June 2009 - 06:04 AM

Actually if you are using Eclipse you don't even have to unpack them. You can point eclipse to the source code zip/jar when you setup your JDK and then whenever you have a question about how Sun did something you just put the cursor on that class and hit F3.

I thought this was the neatest *feature* of BEA workshop (which is Eclipse based) until I was following the install directions for some library and learned that it was a feature of Eclipse in general.

Also installing a java disassembler such as JAD is a pretty good idea. Sometimes organizations are paranoid and obfuscate their classes but more often than not they don't -- so if you ever need to get some info on a proprietary class then JAD works wonders (and if they left debugging info in the file you will even get the original naming).
Was This Post Helpful? 0
  • +
  • -

#8 kmangold  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 11
  • View blog
  • Posts: 167
  • Joined: 24-June 09

Re: Java API Source Code

Posted 25 June 2009 - 06:12 AM

%JAVA_HOME%\jdk1.6.0_14\src.zip

Or whatever version JDK you have installed.
Was This Post Helpful? 0
  • +
  • -

#9 Fuzzyness  Icon User is offline

  • Comp Sci Student
  • member icon

Reputation: 669
  • View blog
  • Posts: 2,438
  • Joined: 06-March 09

Re: Java API Source Code

Posted 07 November 2009 - 03:13 PM

Also, Sun has a downloadable FIle that contains the API as offline webpage. So even when you do not have internet you can just double click each class and it will show the API.

My Contributions->Java API -> Link to the File

I make good use of that like when I am at work and need to look at the API. (Am not allowed to have internet at work on the computers, Laptop ftw, no wireless/direct internet ftl.)
Was This Post Helpful? 0
  • +
  • -

#10 anirelles  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 84
  • Joined: 01-January 09

Re: Java API Source Code

Posted 11 November 2009 - 09:43 AM

What I did is to download the source code of OpenJDK. For tricky things I can have a look at the implementation of the JDK.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1