5

Is there a pluging/feature to count the number of lines in a project?

2

4 Answers 4

6

This may be what you're looking for: http://metrics2.sourceforge.net/

1
  • 1
    Too bad Metrics only appears to be compatible with Eclipse 3.4/3.5 and I sure ain't rolling back from 4.2 :P
    – arkon
    May 28, 2013 at 9:52
4

A very simplistic way is to do a regular expression search for '\n' in your project. It will give you a good idea on the number of lines in your project without installing any extra plug-ins.

1
  • Indeed, and I thought about it. Maybe when I have more free time I'll get around to implementing one of my own, but for now I'm gonna have to go with metrics. It seems way more than I need but increbily useful. Thanks though.
    – ahodder
    Jun 28, 2011 at 14:36
1

Instead of installing a new eclipse plugin; If you are on a linux system:

cd to the eclispe project source directory(workspace/project-name/src)

and enter in termianl:

wc -l *.java

This will show you total number of lines as well as number of lines in each file

1
  • 5
    it is pretty easy solution. also for recursive counting, "find . -name '*.java' | xargs wc -l" can be used
    – Adem
    May 17, 2015 at 11:52
0

A quick way to do it is based on this tutorial I found: http://stephendnicholas.com/posts/eclipse-quick-line-count

To summarize, do the following (to use search in Eclipse press Ctrl+H):

  1. Find the total amount of lines: Search your code for \n using 'regular expression' under your code files (e.g. if you develop in java only then search only *.java files).
  2. Find the total amount of blank lines: Search your code for ^\s*\n
  3. Find the total amount of commented lines: search your code for //.*(\n{1})?

Finally: Get the total amount of lines of code by subtracting 2 and 3 from 1.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.