This is a web-based Java learning platform that allows users to send Java code to a backend server, which compiles and executes the code, then returns the response.
- Java 11 or higher
- Maven
To build the project, run the following command in the project root directory:
mvn clean install
This command will compile the source code, run tests, and package the application.
To run the application, use the following command:
mvn spring-boot:run
The application will start and listen on http://localhost:8080
.
To run the tests, use the following command:
mvn test
This will execute all the unit tests in the project.
- Open Postman
- Create a new POST request to
http://localhost:8080/compile
- Set the body to raw and select JSON (application/json) as the content type
- Enter your Java code as a string in the request body. For example:
{
"code": "public class DynamicClass { public static void main(String[] args) { System.out.println(\"Hello, World!\"); } }"
}
- Send the request
- The response will contain the output of the compiled and executed Java code
This is a simplified implementation for demonstration purposes. In a production environment, you would need to implement proper security measures and error handling.