Solved

JavaNCSS, get metrices for multiple packages

Posted on 2004-09-13
13
239 Views
Last Modified: 2008-03-04
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
Comment
Question by:thomas908
  • 7
  • 5
13 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 12042645
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
 
LVL 35

Expert Comment

by:girionis
ID: 12042651
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
 
LVL 35

Expert Comment

by:girionis
ID: 12042655
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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 8

Author Comment

by:thomas908
ID: 12042661
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
 
LVL 8

Author Comment

by:thomas908
ID: 12042663
My main method just runs the application
0
 
LVL 6

Assisted Solution

by:expertmb
expertmb earned 20 total points
ID: 12042733
>>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
 
LVL 35

Expert Comment

by:girionis
ID: 12042781
Do you have access to the source code? If yes you can find out how you can do it (if at all).
0
 
LVL 8

Author Comment

by:thomas908
ID: 12042826
>>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
 
LVL 35

Expert Comment

by:girionis
ID: 12042838
Yes.
0
 
LVL 8

Author Comment

by:thomas908
ID: 12042851
yes its open source
0
 
LVL 35

Accepted Solution

by:
girionis earned 480 total points
ID: 12042858
Can you take a look to see how it reads the input?
0
 
LVL 8

Author Comment

by:thomas908
ID: 12042892
you were right, it is traversing through all the parameter. So multiple parameters can be specified.
thanks
0
 
LVL 35

Expert Comment

by:girionis
ID: 12042922
Thank you for accepting, glad problem is solved :)
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now