Solved

JavaNCSS, get metrices for multiple packages

Posted on 2004-09-13
13
237 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
 
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

757 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

21 Experts available now in Live!

Get 1:1 Help Now