I'm not quite sure what you're trying to achieve, and I'm not really a Java guru, so I think you might have to experiment a bit. Just a couple of comments:
- If you simply want to analyse what students submitted for your own interest rather than for marking purposes, I'd suggest just downloading all the responses to a quiz as an Excel spreadsheet, via the Moodle Quiz > Results > Responses menu. If you open that spreadsheet in Open Office or Excel and save that as a .csv file you can analyse it at your leisure. I use the Python csv module to pull out the actual answers. I recommend going via Excel rather than exporting all the responses from Moodle as a .csv file, which seems to have issues when the responses are code.
- If you want to analyse student responses as part of the marking process then your template code will have to be a script that compiles the student code first and then inspects it before running it. I always write such scripts in Python, using the subprocess module for compiling and running the student code in (say) Java. But you can presumably do the scripting in Java. With such a script approach you should be able to pass whatever command-line options you like to the compile and execute phases.