Skip to content
cayhorstmann edited this page Aug 23, 2019 · 2 revisions

Install essential software

sudo apt install openjdk-8-jdk mercurial ant empty-expect

Check out the Code

git clone https://github.com/cayhorstmann/codecheck

Build the Checker

cd codecheck/checker
ant jar

This makes a file codecheck.jar.

To test that it works, run

./codecheck -t ../samples/java/test4

You should get a text report that awards 2/2 points.

Add the Tool Libraries

Make a subdirectory checker/lib and place into it junit.jar and hamcrest-core.jar from the JUnit download page

Visit the Checkstyle download page, download and uncompress the Checkstyle binary distribution, and put the file checkstyle-x.y-all.jar into the subdirectory checker/lib.

Create a Report Signing Key

It is best if you have a code signing certificate from Comodo, Thawte, Verisign, or another CA whose root key is in each JVM. If you do, put the certificate in a Java keystore codecheck.jks with alias codecheck and store password and key password both set to secret, following the directions of the vendor.

If not, make your own private and public key.

Run

cd checker
keytool -genkeypair -keystore codecheck.jks -alias codecheck
chmod 400 codecheck.jks
keytool -export -keystore codecheck.jks -alias codecheck -file codecheck-public.cer
keytool -importcert -keystore codecheck-public.jks -alias codecheck -file codecheck-public.cer
rm codecheck-public.cer

When prompted for a password, use secret.

You need to keep codecheck.jks safe. Note that the server upload script copies it to the /opt/codecheck directory of the server. Give codecheck-public.jks to anyone who wants to verify files. You can safely put this file on a public web site.

If you use a key signed by a CA, then anyone can verify the signed zips from students by running

jarsigner -verify Problem.signed.zip

If not, the verifier needs a copy of the public key store, and then runs

jarsigner -keystore codecheck-public.jks -storepass secret -verify Problem.signed.zip