Skip to content

Setting Up CheckStyle

Low Jun Kai, Sean edited this page Aug 13, 2020 · 11 revisions

Setting Up Checkstyle


  1. Go to your Ubuntu or Mac Terminal and download the checkstyle jar file and the cs2030 xml file to prepare the setup for checkstyle. The following 2 commands below downloads the required files
wget http://www.comp.nus.edu.sg/~cs2030/checkstyle-8.2-all.jar
wget http://www.comp.nus.edu.sg/~cs2030/cs2030_checks.xml

  1. Make sure you place these 2 files in the same directory as your java files.

  2. To run the checkstyle command, execute the following command:

java -jar ./checkstyle-8.2-all.jar -c ./cs2030_checks.xml *.java 
  1. To run the checkstyle on specific files, execute the following command:
java -jar ./checkstyle-8.2-all.jar -c ./cs2030_checks.xml [YOUR_JAVA_FILES]

For example:

java -jar ./checkstyle-8.35-all.jar -c ./cs2030_checks.xml Point.java Circle.java Square.java 
Clone this wiki locally