Virtual Machinery logo JHawk Command Line
Product Home Application Eclipse Plugin Command Line Metrics Guide Download Free Trial FAQ, News, Bugs Other Products
JHawk Command Line


JHawk also comes with a command line interface which is accessed using the JHawkCommandLine jar which is included in the ...\code directory of your distribution. A summary of the commands will be shown if you run -


java -jar JHawkCommandLine.jar -?

The full syntax of the command line is -
java -jar VMJHawkCommandLine.jar [-c csvfile] [-p propertiesfile] [-d directories] [-f files] [-h htmlfile] [-l levels] [-n name] [-r] [-s startpath] [-x excludedirectories] [-xf excludedfiles]

To ensure that there is adequate memory and stack space you should include the following after the java command in the command line -
-Xss1m -Xms64m -Xmx512m

The arguments -
directories, files, excludedfiles and excludeddirectories
are all regular expressions. If you want to know more about regular expressions in Java then you should look here - http://java.sun.com/docs/books/tutorial/extra/regex/

File selection

The File selection criteria allow you to select and exclude files and directories based on regular expressions. The regular expressions are tested against the full pathname of each file. So if your expression for excluded files is .*FullTest*java then you will exclude C:\Test\java\bin\com\company\package\FullTest.java and D:\javasdk1.2\bin\com\anothercompany\package\FullTest.java. If your expression simply reads FullTest*java then neither will be excluded.

  • -f files Only analyze files that meet the regular expression files
  • -d directories Only analyze files in directories that meet the regular expression directories
  • -xf excludedfiles Don't analyze files that meet the regular expression excludedfiles
  • -xd excludeddirectories Don't analyze files in directories that meet the regular expression excludeddirectories

Output files

  • -c csvfile Output results in csv format to file with name csvfile. The file will be named csvfile.csv
  • -x xmlfile Output results in xml format to file with name xmlfile. The file will be named xmlfile.xml
  • -h htmlfile Output results in html format to file with name htmlfile. The file will be named htmlfile.html

Output detail

  • -l levels The levels string indicates the level of detail to be output and can contain one or more ofthe values p, c and m (packages, classes and methods repectively). All analysis will start with the system summary

Other Commands

  • -r Recursively search subdirectories for files to analyze
  • -s startpath The path of the directory from which the search for files to analyze will start - the default is the current directory ('.')
  • -p propertyfile The path of the properties file to be used to configure JHawk - the default (which must be present on the classpath if no other file is defined) is jhawk.properties
  • -n name The name to be used in the documentation to describe the group of Java files being analysed
  • -? Show the help information about the command line