views:

145

answers:

3

I am pretty sure that this is a stupid question but after poking around on the sun page for about an hour I am completely confused.

I want to get the source (.java NOT .class) files for this:

sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream

or more generally just the entire

sun.net.www.protocol.https 

package. Do I need the java SDK (Software Development Kit), the JDK (Java Development Kit) or something else? I seriously think Sun should redesign their website.

Update Sorry forgot to mention. I need Update 17 or it will not be helpful. I have an exception that I cannot figure out and I was thinking that if I could look at line XX in HttpsURLConnectionImpl then I could figure out why the exception is being thrown.

Conclusion Just to document what I found:

I appears that they are not available (maybe in the USA but not in Canada?)

This site has some source code but not the https code that I am interested in.

See the best answer for more info.

+2  A: 

Sun doesn't publish this. You can look at the implementation in OpenJDK or Apache Harmony to get some ideas.

bmargulies
It's not available?
sixtyfootersdude
I thought all the java source was viewable? ...Guess not.
sixtyfootersdude
Everything except the sun.* classes is in the normal JDK download, if I remember correctly. For sun.*, you have to use OpenJDK as Michael Barker says. I don't know if OpenJDK uses the exact same code or not.
Michael Myers
Any sun.* class files are their internal implementation of the JVM, and they do not open source that part of it. They do open source the rest of the java libraries - i.e. "core" java
aperkins
AFAIK, while they weren't published under a full open source license, these classes as well as the C++ code of the JVM have been available on the sun developer network for a long time.
Michael Borgwardt
@Michael Borgwardt: Where can I find them if they are published? Is this what you are referring to? http://download.java.net/jdk6/6u17/promoted/b04/index.html
sixtyfootersdude
@sixtyfootersdude It's been a long time since I looked at it, but looks like that's it, yes.
Michael Borgwardt
+3  A: 

From the Open JDK (via google code search)

Michael Barker
+1: Thanks for the input. What I really need is the exact class from the JRE (see update in question). But that might help with basic understanding.
sixtyfootersdude
+1  A: 

Here is a link from docjar

Alternatively, use a decompiler. I used to use Jad a while back not sure if it still works for recent JREs.

Vinodh Ramasubramanian
+1; Thanks for the input. However this is not identical to one in the JRE. I am trying to figure out why this exception is being thrown. The stack trace looks like this: "at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:230)". Unfortionatly the line numbers don't match up. Thanks for the help though!
sixtyfootersdude
Will a decompiler decompile onto the correct number of lines? Ie: will the exception stack dump line numbers correspond to decompiled code. I don't think so but it is possible (if the decompiler is smart)
sixtyfootersdude
Jad has an option to add the original line numbers to each line.` -lnc - annotate the output with line numbers (default: off)`
Vinodh Ramasubramanian