Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

No of classes, packages and LOC of whole Java api ?

 
Hanuman Nishad
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone, I have curiosity about java api such as how many classes, packages are present in it. and also what it the line of code of whole Java API? I've read in java specialist newsletter that in java 1.3, the LOC was around half a million. what about java 1.6 ?
 
Campbell Ritchie
Sheriff
Pie
Posts: 50196
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Open the API page, highlight the list of packages, or the list of classes, then copy and paste to a word processor. Then use the word count. See what you get. That should count classes (including interfaces and enums) and packages. Lines of code is more difficult.
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The class library source code comes with the JRE in a file called src.zip. You could run a package like http://javancss.codehaus.org/ over it, which will provide the Non Commenting Source Statements (NCSS) - a much better number than the largely meaningless LOC. But through the recursive use of a grep-like tool you can get LOC as well.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15482
43
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But note that the code you'll find in src.zip is only the Java part of it - many methods are implemented as native methods (programmed in C), that source code is not included in the src.zip.

You can get the complete source code (including the native code of the standard classes, and even the source code of the JVM, the compiler and tools) from the OpenJDK website.
 
Hanuman Nishad
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks to everyone for giving tips to calculate the LOC of java api. -f anyone knows exact LOC of java api please inform me.
 
Campbell Ritchie
Sheriff
Pie
Posts: 50196
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's 87435843875682359873649562394639459863274639659376496476439857 lines
 
Aniruddh Joshi
Ranch Hand
Posts: 275
Eclipse IDE jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you want to ask this question in an interview ?
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hanuman Nishad wrote:If anyone knows exact LOC of java api please inform me.

Why would anyone here take the time to calculate those numbers since now you know how to do it yourself? You know, teach a man to fish and all that.
 
Campbell Ritchie
Sheriff
Pie
Posts: 50196
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lester Burnham wrote: . . . teach a man to fish and . . .
. . . he'll spend all day at the riverside.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic