JavaNCSS - Usage |
Then to start JavaNCSS type: java javancss.Main. As an alternative you can edit and use either the javancss.bat or javancss file. Just change the JAVA_HOME and CLASSPATH variables according to your system.
Now for the first run type in (being in the javancss-x.y directory itself):
./bin/javancss -gui src/test/resources/*.java
or
./bin/javancss -gui -recursive src/test/resources/
If no parameter is provided for JavaNCSS, standard input (stdin) is used as the input stream. Multiple java source files can be specified in the command line. If a '@' char is put in front of a file name, then not this file will be measured but its content will be interpreted as a list of Java source files that shall be counted. The '@' functionality can be used recursively inside this file as well. Wild cards are not supported yet. (If the operating system processes the command line for the program, then you are lucky. Windows doesn't do that.) Instead use something like cat *.java | javancss or type *.java | javancss. Of course, this can lead to ambiguities when mixing source files that belong to a package with files that doesn't.
If no option is given, JavaNCSS only calculates the total non commenting source statements (NCSS) of the given input.
JavaNCSS can also be used conveniently via Ant. For details have a look at the JavaNCSS Ant Task page, especially at the example at the bottom of that page. You can also have a look at the build.xml file that gets distributed with JavaNCSS itself (see "javancss" target).
Assuming you have e.g. Xalan2 installed and somewhere in your path is a shell script named 'xslt' that knows how to invoke Java with the Xalan 2 main processor class (org.apache.xalan.xslt.Process), here is how you can make use of JavaNCSS' XSLT stylesheet:
cd javancss-x.y
javancss -all -xml -recursive src > example.xml
xslt -in example.xml -xsl xslt/javancss2text.xsl
Have fun. If you create a useful new stylesheet for JavaNCSS, I would be happy to get a copy of it.
Use e.g. batik as an SVG viewer and have a look at the example files in directory xslt/svg under the JavaNCSS home directory.
Here is an example SVG chart file.
Generation of SVG files is similar to using other XSLT stylesheets as described above.