The pandemics has incredibly increased the number of cheating cases. Do you know of any script (bash or other scripting language) for checking a bunch of Java code submissions for similarity? I know I could use diff, but it would be hard to detect similarity.

  • 3
    $\begingroup$ Let me give a warning about such things, as I've done on another site. Any cheating detection system, automated or not, needs to have the property that it produces zero false positives. But it isn't well understood that a system permitting no false positives will almost invariably produce some false negatives. But the consequences of error in a cheating detection system are so asymmetrical that such a rule is required. So, to use such a script, if it exists, you need additional measures as well to assure fair treatment. $\endgroup$
    – Buffy
    Commented Nov 20, 2020 at 16:37
  • $\begingroup$ If your question is different from the one indicated in the closed message, please edit the question to make the difference clearer and it can be reopened. $\endgroup$
    – Ben I.
    Commented Nov 22, 2020 at 22:55

1 Answer 1


Take a look at MOSS from Stanford (https://theory.stanford.edu/~aiken/moss). It is an easy to use free web service that compares files and reports similarities. You set up a free account and submit a request and what is returned is a URL to a report showing the similarities of various files.

I have found that the easiest way to do this is to submit a .tar file structured at the first level as a series of sub directories, each identifying a single student (name, studentID, etc). Beneath each student directory are the file(s) they have submitted. These commonly have exactly the same names as the assignment typically specifies the class names of the Java classes.

For small assignments, you will get a high correlation between students as there is only so much variation possible, but you can look at the "most similar" and get a good feel for whether cheating is likely to have taken place. Depending on how the students actually submit their programs, it may be easy to write a script that automates the process. I'm happy to share details with anyone


Not the answer you're looking for? Browse other questions tagged or ask your own question.