tags:

views:

4183

answers:

3

I have a Java project in Eclipse with ~10 packages and ~10 class files per package. Is there a way to determine total lines of code for the whole project from within Eclipse? I am familiar with other tools (e.g., Code Analyzer, wc, etc.) but I want to know if there is a way to do this within Eclipse (or get confirmation that there is no way to do it).

+3  A: 

Here's a good metrics plugin that displays number of lines of code and much more:

http://metrics.sourceforge.net/

It says it requires Eclipse 3.1, although I imagine they mean 3.1+

Here's another metrics plugin that's been tested on Ganymede:

http://eclipse-metrics.sourceforge.net

AlbertoPL
Note that http://metrics2.sourceforge.net/ states that the first plugin above (http://metrics.sourceforge.net/) is discontinued and metric2 is intended to be a continuation.
Bert F
A: 

I think if you have MyEclipse, it adds a label to the Project Properties page which contains the total number of source code lines. Might not help you as MyEclipse is not free though.

Unfortunately, that wasn't enough in my case so I wrote a source analyzer to gather statistics not gathered by other solutions (for example the metrics mentioned by AlbertoPL).

kd304
Care to share it for community's use?
Gala101
@Gala101: http://code.google.com/p/javasourcestat/
kd304
+1  A: 

Are you interested in counting the executable lines rather than the total file line count? If so you could try a code coverage tool such as EclEmma. As a side effect of the code coverage stats you get stats on the number of executable lines and blocks (and methods and classes). These are rolled up from the method level upwards, so you can see line counts for the packages, source roots and projects as well.

Rich Seller