Why not just have the students mail their final version for grading to the instructor, who can easily put them in files, compile and test them, and print them if necessary. To save time, set an alarm to time out any submission that takes too long to compile and run.