P
P
piar7772018-09-23 00:19:06
Java
piar777, 2018-09-23 00:19:06

How to create a Java lesson constructor?

Many people know resources such as htmlacademy or Stepik, where you need to make changes to the code step by step, click on the check button, and if everything is correct, then go to the next step.
What tools can be used to do the same for the Java language?
Example:
Task: Change the code so that it goes through the compilation stage.
The student changes the code, presses the "check" button.
If he answers correctly, then he goes to the next question, if not, then the line where he made a mistake is highlighted.
It would be great if you specify ready-made tools for creating such "lessons".

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
illuzor, 2018-09-23
@iLLuzor

There are no ready made tools. This task is very large and complex. Doing this in Java is a very dubious idea, it's easier to do it on the web using js. The biggest and hardest part is the server. Here it can be safely written in Java. I'm afraid a task of this magnitude will be overwhelming for you. Unless you can pick up the edu plugin for idea (if its code is open).

A
andrey_hse, 2018-09-24
@andrey_hse

In this case, the task consists of two parts:
1. Frontend - a page with a task and a text area for entering a code. You can write on anything: Spring MVC, Node JS, or do static HTML pages in general. When you click on the "check" button, a request is sent to the backend, the request contains a code in text form.
2. Backend - another http server that is responsible for compiling Java code. It is best to write it in Java (for example, Spring). Look at StackOverflow answers for the query "dynamic java code compilation" - it will give you about the JavaCompiler interface, there are also wrapper libraries with a simpler API for these purposes. That is, your backend server will accept the code as a string at a certain URL, compile it, and issue the compilation result at the output, or you can even send the result with System.out.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question