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.sajitkhadka.com
- 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-compilerjava -version
mvn -versionmvn clean installmvn spring-boot:runThe 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:latestContributions, issues, and feature requests are welcome!
Feel free to:
- Submit a pull request
- Create an issue on GitHub
- Provide feedback or suggestions