How to Use the API
The API allows you to compile and execute Java code with optional arguments. Below is an example of how to interact with it.
Endpoint
POST /api/compile
Request Body
{
"code": "String",
"input": "String (optional)"
}
Response
{
"status": "success" | "error",
"message": "String (output or error details)",
"errors": [
{
"line": Number,
"message": "String"
}
]
}
Example
Use the following request with curl:
curl -X POST https://java-sandbox.sajit.me/api/compile \
-H "Content-Type: application/json" \
-d '{
"code": "public class Main { public static void main(String[] args) { System.out.println(\"Hello, World!\"); } }",
"input": ""
}'