A desktop-based Hotel Management System built using Java Swing for the GUI and MySQL for data storage.
It helps manage common hotel operations like room management, employee management, drivers/pickup services, and reception tasks through an easy-to-use interface.
- Language: Java
- UI: Java Swing / AWT
- Database: MySQL
- Database Connectivity: JDBC (MySQL Connector/J)
- Table Rendering:
net.proteanit.sql.DbUtils(used to show SQL ResultSet in JTable)
From the current codebase, the application includes modules like:
- Login
- Dashboard
- Reception
- Add Employee (Admin)
- Add Rooms (Admin)
- Add Drivers (Admin)
- Rooms View (JTable data load)
- Employee View / Manager Info
- Departments View
- Pickup Service (Driver lookup by car brand)
UI navigation is mainly done using Swing windows (
JFrame) and menu actions.
HotelManagementSystem/
├── src/
│ └── HotelManagement/
│ ├── HotelManagementSystem.java # Entry window (splash + Next -> Login)
│ ├── Login.java # Auth screen
│ ├── Dashboard.java # Main dashboard + menus
│ ├── Conn.java # MySQL connection helper
│ └── ... # Other modules (Rooms, Employees, etc.)
└── README.md
- Java (JDK 8+ recommended)
- MySQL Server (local)
- MySQL JDBC Driver (Connector/J) available in your project classpath
- (Optional) IDE like IntelliJ IDEA / Eclipse / NetBeans
CREATE DATABASE hms;
USE hms;Your code queries tables like:
loginRoomEmployeeDepartmentdriver
create database hms;
show databases;
use hms;
create table login( username varchar(40), password varchar(40) );
insert into login values('admin','12345');
select * from Login;
create table employee(name varchar(25), age varchar(10), gender varchar(15), job varchar(30), phone varchar(15), aadhar varchar(40), email varchar(20));
describe employee;
select * from employee;
create table room(roomnumber varchar (10), availability varchar(20), cleaning_status varchar(20), price varchar(20), bed_type varchar(20));
select * from room;
create table driver(name varchar(20), age varchar(10), gender varchar(15), company varchar(20), branch varchar(20), available varchar(20), location varchar(40));
select * from driver;
create table customer(document varchar(20), number varchar(30), name varchar(30), gender varchar(15), country varchar(20), room varchar(10), checkintime varchar(80), deposit varchar(20));
select * from customer;
create table department(department varchar(30), budget varchar(30));
insert into department values ('Front Office','500000');
insert into department values ('Housekeeping','40000');
insert into department values ('Food and Beverage','23000');
insert into department values ('Kitchen or Food Production','540000');
insert into department values ('Security','320000');
select * from department;Tip: Ensure table names match exactly what your code queries (case sensitivity may vary by OS/MySQL settings).
The connection is currently created in src/HotelManagement/Conn.java.
Instead of hardcoding credentials, use environment variables or a config file.
Example environment variables:
HMS_DB_URL→jdbc:mysql://localhost:3306/hmsHMS_DB_USER→rootHMS_DB_PASS→your_password
If you want, I can also help you refactor Conn.java to load these securely.
- Open the project in IntelliJ / Eclipse.
- Ensure JDBC driver is added to the classpath.
- Start MySQL server and verify the database exists.
- Run
src/HotelManagement/HotelManagementSystem.java(main entry).
If your classpath is set correctly:
javac -d out src/HotelManagement/*.java
java -cp out HotelManagement.HotelManagementSystemIf you use external libraries (like DbUtils, MySQL connector), you must add them to the
-cpclasspath.
The UI loads image assets like:
icons/first.jpgicons/second.jpgicons/third.jpg- etc.
Make sure the icons/ folder is available on the runtime classpath (commonly placed inside your project resources).
- Hardcoded DB credentials inside the repo is unsafe.
- Some SQL queries are built using string concatenation (can lead to SQL injection). PreparedStatements are recommended.
- There is no Maven/Gradle build file currently; adding one would make setup much easier.
- Add Maven/Gradle build support
- Use PreparedStatement everywhere
- Implement role-based access (Admin vs Receptionist)
- Add input validation and better error handling
- Add export reports (PDF/Excel)
- Add unit tests
Ashish Raj
GitHub: ashishraj1504
This project is currently not licensed.
If you want it to be open-source, consider adding a MIT or Apache-2.0 license.