JavaNCSS, get metrices for multiple packages

I am trying to use javaNCSS
http://www.kclee.de/clemens/java/javancss/
to get the number of classes, methods, comments etc of classes in various packages. i can do it for 1 package at a time such as

E:\Test\javancss21.41>.\bin\javancss -gui pack1\pack2\pack3\main\*.java

It gives me the metrics for pack1\pack2\pack3\main package. But I have number of other packages such as

pack1\pack2\abc
pack1\pack2\xyz
pack1\pack2\abc\pack4

etc.
Will I have to write seperate commands to find the metrics for all the packages or is there a way to do it with one command.

pack1 is the root pack for the application. I am using windows



LVL 8
thomas908Asked:
Who is Participating?
 
girionisConnect With a Mentor Commented:
Can you take a look to see how it reads the input?
0
 
girionisCommented:
There is a way to do with oen command, just pass it in the command line options:

E:\Test\javancss21.41>.\bin\javancss -gui pack1\pack2\pack3\main\*.java blabla\*.java ...

and inside your main method just read them using the arguments[] parameter.
0
 
girionisCommented:
E:\Test\javancss21.41>.\bin\javancss -gui pack1\pack2\pack3\main\*.java pack1\pack2\abc\*.java pack1\pack2\xyz\*.java

String firstPackage = args[0];
String secondPackage = args[1];
...
...
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
girionisCommented:
Alternatively if you know the path you can do it recursively in your code. Here is an exampel of how to read files recursively:

http://javaalmanac.com/egs/java.io/GetFiles.html
0
 
thomas908Author Commented:
Sorry, didn't get it.
My main method has nothing to do with the calculation of metrices. The metrices are calcualted by java NCSS
0
 
thomas908Author Commented:
My main method just runs the application
0
 
expertmbConnect With a Mentor Commented:
>>E:\Test\javancss21.41>.\bin\javancss -gui pack1\pack2\pack3\main\*.java
just an alternate
write these things in a batch or ant build file.
0
 
girionisCommented:
Do you have access to the source code? If yes you can find out how you can do it (if at all).
0
 
thomas908Author Commented:
>>Do you have access to the source code? If yes you can find out how you can do it (if at all).

are u asking about javaNCSS source code
0
 
girionisCommented:
Yes.
0
 
thomas908Author Commented:
yes its open source
0
 
thomas908Author Commented:
you were right, it is traversing through all the parameter. So multiple parameters can be specified.
thanks
0
 
girionisCommented:
Thank you for accepting, glad problem is solved :)
0
All Courses

From novice to tech pro — start learning today.