wood burning stoves 2.0*
The moose likes Java in General and the fly likes No of classes, packages and LOC of whole Java api ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "No of classes, packages and LOC of whole Java api ? " Watch "No of classes, packages and LOC of whole Java api ? " New topic
Author

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

Hanuman Nishad
Greenhorn

Joined: Jul 28, 2010
Posts: 12
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 ?


SCJP with 95%
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39090
    
  23
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

Joined: Oct 14, 2008
Posts: 1337
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

Joined: Aug 16, 2005
Posts: 14195
    
  20

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.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Hanuman Nishad
Greenhorn

Joined: Jul 28, 2010
Posts: 12
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

Joined: Oct 13, 2005
Posts: 39090
    
  23
It's 87435843875682359873649562394639459863274639659376496476439857 lines
Aniruddh Joshi
Ranch Hand

Joined: Jul 29, 2008
Posts: 275

Do you want to ask this question in an interview ?


Anrd
"One of the best things you could do is to simplify a larger application into a smaller one by reducing its process and complexity - Fowler"
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
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

Joined: Oct 13, 2005
Posts: 39090
    
  23
Lester Burnham wrote: . . . teach a man to fish and . . .
. . . he'll spend all day at the riverside.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: No of classes, packages and LOC of whole Java api ?