Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to count lines of Java code using IntelliJ IDEA?

How to count lines of Java code using IntelliJ IDEA?

like image 790
Gary Avatar asked Aug 08 '10 18:08

Gary


People also ask

How do I count the number of lines in a Java project?

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. This one is actually quite good!

How do you count lines of code?

To use cloc simply type cloc followed by the file or directory which you wish to examine. Now lets run cloc on it. As you can see it counted the number of files, blank lines, comments and lines of code. Another cool feature of cloc is that can even be used on compressed files.

How do I count files in IntelliJ?

Launch it via new button that is installed in lower left corner of IntelliJ IDEA window. It has additional settings: File - Settings - (Project Settings) Statistic. The Statistic plugin provides file counts in addition to line counts.

How do I count the number of methods in a Java class in IntelliJ?

Just Follow the instructions inside the plugin page. Then go to class matrix tab. then you can see the method count. For future reference: Go to help -> find action -> calculate metrics.


2 Answers

The Statistic plugin worked for me.

To install it from Intellij:

File - Settings - Plugins - Browse repositories... Find it on the list and double-click on it.

Access the 'statistic' toolbar via tabs in bottom left of project screen capture of statistic toolbar, bottom left

OLDER VERSIONS: Open statistics window from:

View -> Tool Windows -> Statistic

like image 167
larham1 Avatar answered Oct 01 '22 05:10

larham1


Quick and dirty way is to do a global search for '\n'. You can filter it any way you like on file extensions etc.

Ctrl-Shift-F -> Text to find = '\n' -> Find.

Edit: And 'regular expression' has to be checked.

like image 28
Neil Avatar answered Oct 01 '22 06:10

Neil