Solved

JavaNCSS, get metrices for multiple packages

Posted on 2004-09-13
13
244 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
maven disable workspace resolution 1 79
Website checklist for browser compatibility? 2 57
JDBC performance 8 35
Tomcat 9 + java 8 error while trying to deploy a war file 2 862
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
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…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses

752 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