A simple online judge system where you can solve programming problems and get your code automatically evaluated. Think of it like LeetCode or HackerRank, but running on your own computer!
Works on Windows, Linux, and macOS! π₯οΈ π§ π
Looking for the Android or Desktop version? We have a Kotlin Multiplatform (KMP) app that connects to this backend!
An online judge is a system that:
- Shows you a programming problem (like "add two numbers")
- Lets you write code to solve it
- Runs your code against test cases
- Tells you if your solution is correct β or wrong β
- β Browse programming problems (Easy, Medium difficulty)
- β Write code in Python, Java, C++, JavaScript, or C
- β Submit your code and see instant results
- β See which test cases passed or failed
- β Practice coding in a beautiful dark-themed editor
| Software | Why You Need It | How to Check |
|---|---|---|
| Java 17+ | Runs the server | java -version |
| Maven | Builds the project | mvn -version |
πͺ Windows
| Language | How to Install |
|---|---|
| Python | Download Python - check "Add to PATH" |
| Java | Already included with Java 17 |
| C/C++ | Download MinGW or use Visual Studio |
| Node.js | Download Node.js |
π§ Linux (Ubuntu/Debian)
sudo apt install python3 gcc g++ nodejsπ macOS
brew install python3 gcc nodeπ Read the Full Docker Setup Guide β
Quick links:
| Platform | How to Install |
|---|---|
| Windows | Docker Desktop for Windows |
| Linux | Docker for Linux |
| macOS | Docker Desktop for Mac |
Navigate to the project folder:
cd path/to/online-judgeOn Windows (Command Prompt or PowerShell):
mvn spring-boot:runOn Linux/macOS:
./mvnw spring-boot:runWait until you see:
Started OnlineJudgeApplication in X seconds
Initialized 5 sample problems
Go to: http://localhost:8081
- Click on any problem (like "Two Sum")
- Write your code in the editor
- Click Submit
- See if you got ACCEPTED β
The main configuration file is src/main/resources/application.yml.
Find this section in the file:
executor:
mode: local # Change to 'docker' for Docker mode| Mode | When to Use |
|---|---|
local |
Default. Code runs directly on your computer. Faster but less secure. |
docker |
Code runs inside Docker containers. Slower but isolated and safer. |
The app runs on port 8081 by default. To change it:
server:
port: 8081 # Change this numberonline-judge/
βββ src/main/java/com/onlinejudge/
β βββ OnlineJudgeApplication.java # Main entry point
β βββ controller/ # Handles web requests
β βββ service/ # Business logic
β β βββ LocalCodeExecutor.java # Runs code locally
β β βββ DockerCodeExecutor.java # Runs code in Docker
β βββ model/ # Data structures
β βββ repository/ # Database access
β
βββ src/main/resources/
β βββ application.yml # Configuration
β βββ static/ # Frontend files
β βββ index.html # Homepage
β βββ problem.html # Problem page
β βββ css/styles.css # Dark theme styling
β
βββ pom.xml # Project dependencies
The app comes with 5 practice problems:
| # | Problem | Difficulty | Description |
|---|---|---|---|
| 1 | Two Sum | Easy | Add two numbers |
| 2 | Palindrome Check | Easy | Check if a string reads the same forwards and backwards |
| 3 | FizzBuzz | Easy | Classic programming exercise |
| 4 | Factorial | Medium | Calculate n! |
| 5 | Prime Number Check | Medium | Determine if a number is prime |
| Language | Windows Command | Linux/Mac Command |
|---|---|---|
| Python | python |
python3 |
| Java | javac & java |
javac & java |
| C++ | g++ |
g++ |
| JavaScript | node |
node |
| C | gcc |
gcc |
Note: The app automatically detects your OS and uses the correct commands!
β οΈ Code runs directly on your machineβ οΈ Not recommended for untrusted code- β Great for personal practice
- β Code runs in isolated containers
- β Network is disabled (code can't access internet)
- β Memory and CPU limits applied
- β Safer for running untrusted code
"'python' is not recognized"
- Install Python from python.org
- Make sure to check "Add Python to PATH" during installation
- Restart your terminal after installation
"'g++' is not recognized"
- Install MinGW-w64 from mingw-w64.org
- Add
C:\mingw64\binto your PATH environment variable
"Port 8081 already in use"
# Kill the process using port 8081
fuser -k 8081/tcp # Linux
lsof -ti:8081 | xargs kill # macOS
# Then try again
mvn spring-boot:run"python3: command not found"
# Ubuntu/Debian
sudo apt install python3
# macOS
brew install python3"Docker: permission denied" (Linux)
sudo usermod -aG docker $USER
# Then log out and log back inDocker not starting (Windows)
- Make sure Docker Desktop is running
- Check that WSL2 is properly installed
"Compilation Error" when submitting Java
Make sure your class is named Main:
public class Main { // β
Must be named Main
public static void main(String[] args) {
// your code
}
}You write code β Server receives it β Code runs in sandbox
β β
βββββββββββββββββ Result sent back ββββββββββββββββ
- You submit code through the web interface
- Server saves your submission to the database
- Code executor (local or Docker) runs your code
- Your code gets test inputs and produces outputs
- Outputs are compared with expected results
- You see ACCEPTED if all tests pass, or an error otherwise
If you're new to these technologies:
This is a learning project. Feel free to use, modify, and share!
If something doesn't work:
- Check the Troubleshooting section above
- Look at the terminal for error messages
- Make sure all requirements are installed
Happy Coding! π


