Autograding Java code for computer science assignments
April 26, 2021

Webinar: How to automatically grade Java code and code quality

In 30 seconds...

After the success of our previous webinar on Python Autograding, we answered the many requests to cover all ins and outs of Java Autograding in a webinar too. This Java Autograding webinar was part of our monthly focus groups (on April 23rd of 2021) and can be watched on demand now!

Creating a basic autograded Java assignment in CodeGrade

In the first part of this webinar, CodeGrade's founder and product expert Devin Hillenius discusses ways to design your basic autograded Java assignments in CodeGrade. He goes over three aspects: hand in requirements for Java, compiling Java code and I/O tests for Java.

  • Hand In Requirements are an important aspect of all CodeGrade assignments, but especially for the large projects with specific directory structure you have for Java assignments. Three tactics are discussed: denying all files and specifying the files you want in the root of the submission, allowing all files and denying any class files and denying all files and requiring specific folder structures (e.g. `src/com/codegrade/`). A useful tip mentioned in the webinar is to turn off the "Delete leading directories" option for Java submissions in which folder structures are important.
  • Compiling Java code can be done in AutoTest in two ways, either in the per-student setup script or in a separate test. Doing it in the per-student setup script has the benefit that the compiled files are available in all categories, whereas in a separate test you can actually grade the compilation step too. An attentive viewer mentioned that these do not have to exclude each other, and that you can simply grade a compilation step by checking if the compiled files are present or not.
  • Finally, some easy Input and Output tests (I/O tests) are set up for our Sudoku Solver assignment.
Save time by autograding your Java assignments now!

Autograding Java Code Quality

Code Quality autograding is discussed in the second part of the webinar. The Code Quality steps in CodeGrade allow you to very easily use powerful tools to assess student code. In this webinar, Devin explains not only how you can use these powerful tools, but also how you can design your own style guide with custom messages, so that you can use these powerful tools in a very meaningful way that suits your class, your learning goals and the level of your students.

Two linters are discussed:

  • Checkstyle is a static code analysis tool to assess Java code. This tool can be used to check the presentation or "style" of code, and whether that conforms to the style guide you have set up or enforce. It does not check for actual correctness or completeness of code.
  • PMD, or Programming Mistake Detector, is a cross-language source code analyzer that works not only for Java, but also for JavaScript, XML and many other languages and frameworks. It does not detect bad presentation or style, but looks at code structures: inefficient code, bad programming habits and overcomplicated expressions.

Devin discusses many rules and checks that are very suitable for education, or specific courses, and shows how you can use them in your own custom style guide. The examples in this webinar are not meant as an exhaustive list, but rather as inspiration for your own style guide considerations for education. A separate blog on Code Quality in Java, with these lists, will be published on our website soon.

Advanced Java Autograding in CodeGrade

Finally, some more advanced ways of grading Java code are briefly shown. These topics have also been discussed in previous blogs or documentation:

This webinar and article point you in the right direction to set up your own automatic tests for your Java programming assignments. Of course, the possibilities with CodeGrade's AutoTest are endless. Would you like to learn more about setting up Java automatic grading for your code exercise? Feel free to email me at and I’d be more than happy to help out!

Devin Hillenius

Devin Hillenius

Co-founder, Product Expert
Devin is co-founder and Product Expert at CodeGrade. During his studies Computer Science and work as a TA at the University of Amsterdam, he developed CodeGrade together with his co-founders to make their life easier. Devin supports instructors with their programming courses, focusing on both their pedagogical needs and innovative technical possibilities. He also hosts CodeGrade's monthly webinar.

Continue reading

How to adopt automatic grading in your coding course

Autograding is becoming more and more important in coding courses. In this article we discuss how to successfully adopt autograding in your computer science classroom.

Pedagogical Benefits of Automatic Grading in Computer Science education

Computer Science teachers use autograding to scale up their coding classrooms, but also to improve student leaning outcomes and satisfaction. Learn the pedagogical benefits of autograding in this article.

CodeGrade Success Story at the University of Nevada, Las Vegas

CodeGrade increases student performance and helps teachers at UNLV. Professors and e-learning experts from the University of Nevada, Las Vegas share how they adopted CodeGrade and how it made their lives easier.

New CodeGrade features now delivered continuously to you!

CodeGrade now uses Continuous Delivery (CD) to deploy new bug fixes, tweaks and features even quicker and smoother to our customers. We chat with CodeGrade CTO Thomas Schaper to learn more about this improvement!

Sign up to our newsletter

Book a quick 30-minute demo and see how it works for you!