Tutorial: Moodle VPL -- A Java Hello World Program

From dftwiki
Jump to: navigation, search

--D. Thiebaut (talk) 10:17, 13 June 2014 (EDT)


Moodle VPL Tutorials

This tutorial builds on the first one in the series, which should be done first, as the present tutorial skips some steps. This tutorial generates a VPL activity that automatically grades a Java program that prints a "Hello World" message on the screen.


  • Moodle Version 2.7 + (Build: 20140529)
  • VPL Version 3.0.1
  • For details on how Moodle and VPL were installed, go to this page.

VPL Activity Description

Hello World

Due date: Tuesday, 21 June 2016, 8:00 PM
Requested files: HelloWorld.java (Download)
Type of work: Individual work
Grade settings: Maximum grade: 100
Run: Yes Evaluate: Yes
Automatic grade: Yes
Just a simple Hello World in Java

Requested files


// put your code here.
// Make sure that your program does not add extra \n at the end of the output!

Execution files


#! /bin/bash
cat > vpl_execution << 'EOF'
#! /bin/bash
javac -J-Xmx128m HelloWorld.java 
java HelloWorld
chmod +x vpl_execution


No file needed


No file needed


case = Test 1
output = Hello World
case = Test 2
output = "Hello, World


  • Enter the following code in the Edit window of the Test activity area.

public class HelloWorld {

    public static void main(String[] args) {
        System.out.println("Hello, World\n");


  • Click on Save, then Run and verify that "Hello, World" appears in the terminal window.
  • Click on Evaluate and verify that you get 100/100 for the 2 tests.


This concludes this tutorial