Java :: program :: how to invoke the main function with some arguments?

Re: Java :: program :: how to invoke the main function with some arguments?

by Richard Lobb -
Number of replies: 0
You can't do that with the built-in question types. However, you can use the ideas explained in the documentation chapter Implementing or supporting other languages. The template for the question is a script that compiles and then runs the Java program, and you can then pass whatever you like as command line arguments. Or you can make the test code the actual bash script you wish to use to run the student's code. There's a proof of concept for C++ in this posting to github - you just need to change the commands to compile and run Java instead. Note that you need to set the sandbox language to Python (since that's the language of the template) but you need to set the Ace language to Java so the student gets the correct syntax highlighting.