Tutorial: Moodle VPL -- A Java Hello World Program
--D. Thiebaut (talk) 10:17, 13 June 2014 (EDT)
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.
Setup
- 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
HelloWorld.java
// put your code here. // Make sure that your program does not add extra \n at the end of the output!
Execution files
vpl_run.sh
#! /bin/bash cat > vpl_execution << 'EOF' #! /bin/bash javac -J-Xmx128m HelloWorld.java java HelloWorld EOF chmod +x vpl_execution
vpl_debug.sh
No file needed
vpl_evaluate.sh
No file needed
vpl_evaluate.cases
case = Test 1 output = Hello World case = Test 2 output = "Hello, World "
Testing
- 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