You will need to specify a classpath that includes all the jar files. My Java is very rusty and I haven't actually done this in CodeRunner, but you'll need to do something like the following:
- Customise the question (click the Customise checkbox).
- Open the Advanced customisation section.
- In the Sandbox parameters field, set a suitable classpath via the interpreterargs parameter, e.g. something like
{"interpreterargs": ["-cp", "file1.jar:file2.jar:file3.jar", "-Xrs", "-Xss8m", "-Xmx200m"]}
The list of interpreterargs strings are inserted into the command line that runs the compiled class file. So the job will be compiled and run as
javac Thing.java
java -cp file1.jar:file2.jar:file3.jar -Xrs -Xss8m -Xmx200m Thing
The three -X arguments are what you get if you don't specify an explicit interpreterargs parameter.
But I'm very rusty on this - you'll probably have to experiment to get it working.
Alternatively follow the instructions for supporting or implementing new languages to define a question
type that uses Python to compile and run a student's Java program. If you inspect the template for the multilanguage question type you'll be able to see the commands used to compile and run java.
I'm sorry this is a bit high level but I'm about to start the teaching year and I don't have time to test a solution for you.
This might be useful to other Java users, so would you mind posting back here when you've got it working, please?