Accepted answer

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

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:


you could use former instantiations product codepro analytix. this eclipse plugin provides you suchlike statistics in code metrics view. this is provided by google free of charge.


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).


a very simple plugin for counting actual lines of source code is step counter eclipse plugin. please download and try.

github link

place the downloaded jar file under eclipse\plugin folder and restart eclipse.

rightclick and select step counter enter image description here

step result enter image description here


you could use a batch file with the following script:

@echo off
set count=1
for /f "tokens=*" %%g in ('dir "%cd%\src\*.java" /b /s') do (type "%%g") >> lines.txt
set count=1
for /f "tokens=*" %%g in ('type lines.txt') do (set /a lines+=1)
echo your project has currently totaled %lines% lines of code. 
del lines.txt


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.


for eclipse(indigo), install (codepro).

after installation: - right click on your project - choose codepro tools --> compute metrics - and you will get your answer in a metrics tab as number of lines.


under linux, the simpler is:

  1. go to the root folder of your project
  2. use find to do a recursive search of *.java files
  3. use wc -l to count lines:

to resume, just do:

find . -name '*.java' | xargs wc -l    


search > file search

check the regular expression box.

use this expression:


select whatever file types (*.java, *.xml, etc..) and working sets are appropriate for you.

Related Query

More Query from same tag