• Post Reply Bookmark Topic Watch Topic
  • New Topic

Why doesnt oracle share source codes for all its classes ?  RSS feed

 
Rahul Sudip Bose
Ranch Hand
Posts: 637
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please tell. I did not post this in the general java section because it seems to be a trivial thing.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What class are you missing, in particular? A brief look at the contents of the src.zip file that comes with the JDK doesn't indicate anything missing ... ? The native code can be found in the OpenJDK distribution.

Moving to a more serious forum, since it doesn't seem that you want an MD-style answer.
 
Rahul Sudip Bose
Ranch Hand
Posts: 637
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got this doubt after reading a reply to one post by "Mala Gupta " who gave the source code of method println and print (that accept String as a method parameter) from class PrintStream. Here is that post : (I was wondering from where did she come to about those source codes )

http://www.coderanch.com/t/532878/java-programmer-SCJP/certification/toString-method#2417266


 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the contents of the src.zip file that comes with the JDK
 
Rahul Sudip Bose
Ranch Hand
Posts: 637
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I unzipped that src file and all i saw was some tightly packed characters , hardly comprehensible. Please tell me how to see the source code in a neat way.
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rahul Sudip Bose wrote:I unzipped that src file and all i saw was some tightly packed characters , hardly comprehensible. Please tell me how to see the source code in a neat way.


When I unzipped it, I got a directory of six sub directories; and in those subdirs are a whole bunch of subdirs (organized in the java package structure) and a whole bunch of java files.

Henry
 
Rahul Sudip Bose
Ranch Hand
Posts: 637
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry Wong wrote:
Rahul Sudip Bose wrote:I unzipped that src file and all i saw was some tightly packed characters , hardly comprehensible. Please tell me how to see the source code in a neat way.


When I unzipped it, I got a directory of six sub directories; and in those subdirs are a whole bunch of subdirs (organized in the java package structure) and a whole bunch of java files.

Henry


I meant i saw the java files but the code was not formatted...LUCKILY i tried posting it here and it was auto formatted by the ranch...must be a problem with notepad. how do i see that with proper formatting, i cant keep on coming here to do just that.

Also, i am interested in seeing println() code. Where do i look for it ?

 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rahul Sudip Bose wrote:must be a problem with notepad. how do i see that with proper formatting, i cant keep on coming here to do just that.


Try a different editor.

Henry
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There isn't anything scrambled or deliberately made unreadable in src.zip. If you're seeing that, then either your src.zip is corrupted or you're using the wrong tools, or you're using the tools incorrectly.

However, there are some methods that are native, for which you will not find the source code in src.zip. But if you want, you can get the source code of the complete JDK, Java compiler and Java virtual machine from the OpenJDK project.

Rahul Sudip Bose wrote:Also, i am interested in seeing println() code. Where do i look for it ?

First, find out in which class the println() method you're looking for is implemented. Then lookup the source code for that class.

More hints: You usually call println() on System.out. What kind of object is System.out (look it up the API documentation)?
 
Rahul Sudip Bose
Ranch Hand
Posts: 637
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jesper de Jong wrote:.....


got it inside java.io.PrintStream. Using notepad++ now, ten minutes into it and i can "feel" the difference. And the best part, its free ! When will mr.gate$ and his micro$oft make a better product ?

thanks to all for helping me and being patient with my kiddie queries !
rb
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, Mr Gates is not the boss at Microsoft (both without the $ please! No unnecessary bashing just because they try to get money; Oracle isn't much different); Steve Balmer is.

Secondly, Notepad isn't meant for anything but simple text editing of Windows-only files. And it does a decent job at that. For anything more advanced, which includes editing UNIX files which you probably were trying*, there are enough alternatives - starting with Microsoft's own WordPad (also ships with Windows). If you don't like that (and for programming, you won't like that ) there are enough free alternatives.


* Why do I think this? Because Windows uses \r\n (carriage return + line feed) for line breaks, and UNIX uses only \n (line feed). Notepad can only handle \r\n, and will ignore the single \n, or display it as little blocks (like []) on older versions. Both will give you one large line instead of multiple shorter ones.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!