Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 259
  • Last Modified:

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



0
thomas908
Asked:
thomas908
  • 7
  • 5
2 Solutions
 
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
 
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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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
 
expertmbCommented:
>>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
 
girionisCommented:
Can you take a look to see how it reads the input?
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 7
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now