Java Compiler Sandbox API is a Spring Boot project that provides an online Java compiler through a RESTful API. It allows users to compile and execute Java code snippets securely and efficiently.
🌐 Live Demo: java-sandbox.sajit.me
- Compile and execute Java code snippets
- Built-in rate-limiting using Bucket4j
- Caching support with Caffeine
- Ready for containerized deployment with Jib
git clone https://github.com/sajitkhadka/online-java-compiler.git
cd online-java-compiler
java -version
mvn -version
mvn clean install
mvn spring-boot:run
The application will be accessible at http://localhost:8080
Endpoint: POST /api/compile
Request Body:
{
"code": "public class Main { public static void main(String[] args) { System.out.println(\"Hello, World!\"); } }"
}
Response:
{
"output": "Hello, World!\n",
"errors": "",
"success": true
}
- Docker installed and running
# Build using Jib
mvn compile jib:dockerBuild
# Run the container
docker run -p 8080:8080 online-java-compiler:latest
Contributions, issues, and feature requests are welcome!
Feel free to:
- Submit a pull request
- Create an issue on GitHub
- Provide feedback or suggestions