?
Solved

JavaNCSS, get metrices for multiple packages

Posted on 2004-09-13
13
Medium Priority
?
253 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 80 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 1920 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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

719 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