## Question Authors' Forum

### Re: Detection of the main class name in Java

de Antoni Oliver -
Número de respuestas: 0

Hello.

This is for a java_program question type.

So, let me ellaborate: we normally work in an IDE (NetBeans), so I expect part of the students to upload their java files directly and the other part to work directly on Moodle.

Those who code in Moodle will surely make use of the answer box, at least until we start dealing with additional code files when maybe, if they have to code in two places in the same time (Moodle for the main class and some text editor / IDE for the additional classes), they will switch to work entirely in the IDE.

So, if they work in the IDE, I expect them to submit all their files, and not to copy the contents of one in the answer box and provide them as attachments.

Anyway, CodeRunner does work with an empty answer box and attachments, but it does not autodetect the main class name, as it does when the code is submitted with the answer box (it is not trivial to know which one of the attachments is the main class, I guess).

And yes, there's no need to restrict file names. Sure, I expect the main class to be named Main.java, but they'll submit other files which I don't know their names.

As I said previously, a compromise is using the parameters in advanced configuration:

{"sourcefilename": "Main.java"}
This way, it will always execute the class named Main. If they do not provide it, it is going to fail, which is good enough for me.

Thank you!