Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to count lines in a netbeans project

I have netbeans 7 and I was wondering how to calculate the total lines for a project. I have looked through Google but every time I do it I only find dead ends or non working plugins. Does anyone know how to count the lines?

like image 913
me me Avatar asked May 19 '12 01:05

me me


People also ask

How to count the lines of code in a project?

If you want to get the lines of code of a single file, you can use cloc <filename>. We're using the command to get the lines of codes of a simple Vue file. It also recognized that it is a VueJS component. We can check all of the lines of code in a file or directory by the command cloc --by-file.

How do you count lines of code in Java?

cloc is a command-line-based tool. It counts the blank lines, comment lines, actual code lines written in many programming languages.


2 Answers

You can use wordcount that works with 7.1 nb-wordcount that works with 8.2.

To configure wordcount go in Tools->Options->Miscellaneous. You have to change Accept filename if you want other files than Java and Groovy to match.

To display the count window go in Window->Open WordCount Window.

To display stats click on WordCounting (second button). I will display the stats of the directory selected in Projects (window)(it has to be a package or something like Source Packages or Web pages, it won't work if you select the project).

Also if you are on linux you can simply execute :

 find . -name '*.java' | xargs wc -l 
like image 57
alain.janinm Avatar answered Sep 21 '22 23:09

alain.janinm


I know this is a very old question however there is a simpler way of finding the line count in a netbeans project that doesn't involve installing plugins:

  1. Right click on the folder or package you want to find the amount of lines in
    Note: Don't right click on the project itself as that will cause it to count the lines in all the generated files too.
  2. Click on Find or Find in Files or press CtrlF.
  3. Make sure the Match dropdown is set to Regular Expression.
  4. Type in \n into the search box.
  5. Press find and the amount of lines your project has will be displayed at the top of the
    Search Results tab.

Note: In NetBeans, the search is stopped after 5000 results, so if your project is longer than that then this method won't work

like image 31
Dan Avatar answered Sep 21 '22 23:09

Dan