A Java-based Voting System for College Elections using OOP, JDBC, Swing UI, and a simplified blockchain for secure vote recording.
- User Authentication - Secure login and registration for Admin/Student roles
- Election Management - Full CRUD operations for candidates (Admin only)
- Secure Voting - Blockchain-based vote recording with SHA-256 hashing
- Result Processing - Real-time election results with visual progress bars
- Role-Based Access - Separate dashboards for Admin and Student users
- Professional UI - Modern Swing interface with comprehensive validation
- Java 17+ (Java 24.0.2 tested)
- MySQL Server (localhost:3306)
- MySQL Connector/J (
mysql-connector-j-9.4.0.jarincluded)
Option 1: Using PowerShell Script (Recommended)
.\run.ps1Option 2: Manual Compilation and Run
# Compile
.\compile.ps1
# Run
java -cp "out;resources;mysql-connector-j-9.4.0.jar" app.MainRun the SQL schema to create the database:
mysql -u root -p < schema.sqlOr execute schema.sql in MySQL Workbench.
Update resources/db_config.properties with your MySQL credentials:
db.url=jdbc:mysql://localhost:3306/voting_system
db.user=root
db.password=your_passwordUse the run.ps1 script or manual commands above.
Voting System/
├── src/main/java/
│ ├── app/ # Application entry point
│ ├── dao/ # Data Access Objects (Database layer)
│ ├── model/ # Domain models (User, Candidate, Vote, Blockchain)
│ ├── service/ # Business logic layer
│ ├── ui/ # Swing UI components
│ └── util/ # Utility classes (Hashing, Validation, Config)
├── resources/
│ └── db_config.properties # Database configuration
├── docs/ # Original project documentation
├── documentation/ # UI and setup documentation
├── out/ # Compiled classes (generated)
├── schema.sql # Database schema
├── run.ps1 # Run script
├── compile.ps1 # Compile script
└── README.md # This file
- Run Instructions - Detailed setup and usage guide
- UI Enhancements - Complete list of UI features
- UI Flow Diagram - Visual application flow
- Completion Summary - Project overview
- UI Checklist - Implementation checklist
- User Manual - End-user guide
- Test Cases - Testing documentation
- Project Report - Academic project report
- View all candidates with department information
- Cast vote with confirmation (one vote per student)
- View live election results
- Secure logout
- Manage Candidates - Add, edit, delete candidates with table view
- View Results - Detailed election results with percentages
- System Information - View system capabilities and security features
- Password hashing with SHA-256
- Email validation with regex
- One vote per student enforcement
- Blockchain integrity verification
- Role-based access control
- Java 17+ - Core programming language
- MySQL - Database management
- JDBC - Database connectivity
- Swing - GUI framework
- SHA-256 - Cryptographic hashing
- Blockchain - Vote integrity
- Register a new account (Admin or Student)
- Login with your credentials
- Admin can manage candidates and view results
- Students can cast votes and view results
- All votes are recorded on a blockchain for integrity
See Run Instructions for detailed troubleshooting steps.
Common issues:
- ClassNotFoundException: Ensure MySQL connector JAR is in project root
- SQLException: Verify database is running and credentials are correct
- Compilation errors: Run
.\compile.ps1to see detailed errors
- Academic Project - College Voting System
This is an academic project for educational purposes.