Java /packages / supporting files area

Java /packages / supporting files area

von Christian Gasde -
Anzahl Antworten: 1

Hi Richard,

at the moment our students mainly program our Java exercises in Eclipse and add these files to "supporting-files-area":

Java code example

QUESTION:
In Eclipse we use package-declarations like:

package uebungsblatt_1;

public class InvalidBirthdayException extends Exception {
    String message;

    public InvalidBirthdayException() {
        super();

    }
    ...


Here (https://coderunner.org.nz/mod/forum/search.php?id=1&search=java+packages ) I found:

{{ STUDENT_ANSWER|replace({'package': '// package'}) }}

This works fine with all code in the coderunner editor.

Is there any way to apply the above command to the supporting files ( "InvalidBirthdayException.java" in our case)?   I know this is a heavy one. :-)

Best Regard from Coburg
Chris

Als Antwort auf Christian Gasde

Re: Java /packages / supporting files area

von Richard Lobb -
I don't teach Java myself and I thought someone who did might pipe up instead. But in their absence ...

I think you would need to construct a Java question type that is scripted in Python. It could build the appropriate package file structure, copy relevant files into place, then compile and run the code. This old thread includes a demo question type that could probably be adapted to your needs. See in particular the posting by Peter Sander on Tuesday, 26 July 2016, 8:20 AM.