Java code plagiarism checker
A Java assignment is rarely one file. It is a folder of classes, half of it generated by the IDE, and a copy can be spread across all of them under new names. This page covers how to check whole projects, what to do about generated code, and how to tell a real match from two students using the same skeleton.
Checks every .java file against classmates, the web and AI.
Account.javaBankAcct.javaDifferent class name, method name and fields (highlighted). The same overdraft of 50 that the assignment never asked for (underlined), and the same fee rule. Two people do not invent that separately.
How to check a Java class
- One folder per student, with
src/and the package directories left as they are. Do not flatten the project into a single directory. - Remove build output.
target/,build/,out/,bin/,.classfiles,.idea/and.gradle/. Only the sources matter. - Add the starter project. Interfaces, abstract classes, the JUnit skeleton, anything every student began with. Matches against it are left out of every score.
- Upload the ZIP and read the list. Projects come back sorted by score. Open the top ones to see the matching lines side by side.
Why multi-file projects need a different check
Comparing files one against one misses the usual way a Java project is copied. The student does not hand in the same Account.java. They rename it BankAcct.java, move the interest calculation into a new RateHelper class, and merge two small classes into one. No single file looks like any single file in the original.
Checking a student's whole folder as one submission deals with this. The comparison is between everything one student wrote and everything another wrote, so code that moved between files is still found, and the result tells you which file it ended up in.
Generated code, and why small projects score high
Java has more code that nobody wrote than most languages. Before reading anything into a score, know what is likely to be identical in every project:
- Accessors. IntelliJ and Eclipse generate the same getters and setters for the same fields.
equals,hashCode,toString. Generated from a template, identical for identical fields.- The entry point and imports.
public static void main(String[] args)and a block ofjava.utilimports. - The design you specified. If the assignment names the classes, fields and method signatures, every project shares them.
On a 60-line assignment with four fields, that can be half the file. Two things help. Upload a starter project that contains the specified classes and signatures, so they are excluded. Then, when you open a match, look at which lines are shared: a match made of accessors is noise, and a match inside the method the assignment was really about is not.
Check this week's Java project
Upload the class as a ZIP, one folder per student. Starter code is left out.
What students change
| The edit | Hides it from a reader? | Hides it from a structural check? |
|---|---|---|
| Rename classes, methods and fields | Often | No |
| Reorder methods within a class | Often | No |
| Move a method to another class or file | Usually | No |
| Reformat braces, add or strip Javadoc | Sometimes | No |
Swap a for loop for a while loop | Sometimes | Partly |
| Rewrite a loop as a stream pipeline | Often | Partly |
The first four leave the structure of the code as it was. The last two change it for the lines they touch, and the score for those lines drops, but a project is rarely rewritten that way from top to bottom. The untouched methods still line up.
Reading a Java match
- Find the method that carries the assignment. In a bank account exercise that is
withdraw, notgetBalance. A match there matters. A match in the accessors does not. - Look for shared decisions nobody asked for. The same extra field, the same magic number, the same exception swallowed in the same place, the same bug.
- Compare against the rest of the class. If every project scores 60% against every other, the specification is doing the matching. One pair far above the rest is the one to open.
- Check the web result too. Well-known course projects are posted publicly, and a web match links to where the code was found. See checking code against GitHub.
More on thresholds in what a code similarity score means, and on the whole process in how to detect code plagiarism.
Frequently asked questions
How do I check Java code for plagiarism?
Put each student's project in its own folder, keeping the package directories as they are, zip the folders and upload the ZIP. Each project is compared with every other one, with code already on the web, and checked for AI-written code. Results are sorted by score and each one opens the matching lines side by side.
Does it handle projects with many classes?
Yes. A student's whole folder is one submission, so a method that was moved to a different class or file still matches the original.
Will getters, setters and generated methods cause false matches?
They can raise a score on small projects, because every IDE generates the same accessors, equals, hashCode and toString. Upload the class skeleton you handed out as starter code, and when you open a match, check whether the shared lines are the logic or the generated parts.
Does renaming classes and methods hide a copy?
No. Projects are compared by structure, so new class, method and variable names, reordered methods and different formatting do not hide it.
Should I upload compiled files?
No. Upload the .java sources. Leave out target, build, out and bin folders, .class files and IDE settings such as .idea.
Can it tell if Java code was written by ChatGPT or Copilot?
It flags code that is likely AI-written and lists the reasons. Use that to start a conversation with the student, not to end one.
See what is in your class's Java
Whole projects against classmates, past terms, the web and AI, with the lines side by side.
Get started Every plan includes Deep Scans.