Link to home
Start Free TrialLog in
Avatar of thomas908
thomas908

asked on

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



Avatar of girionis
girionis
Flag of Greece image

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.
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];
...
...
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
Avatar of thomas908
thomas908

ASKER

Sorry, didn't get it.
My main method has nothing to do with the calculation of metrices. The metrices are calcualted by java NCSS
My main method just runs the application
SOLUTION
Avatar of expertmb
expertmb

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Do you have access to the source code? If yes you can find out how you can do it (if at all).
>>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
Yes.
yes its open source
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
you were right, it is traversing through all the parameter. So multiple parameters can be specified.
thanks
Thank you for accepting, glad problem is solved :)