A comprehensive Java-based Library Management System that handles book cataloging, member management, borrowing operations, and persistent data storage. The system provides a complete solution for managing library operations with a user-friendly console interface.
Completed - All core features implemented and tested
-
Java 21 - core programming language
-
Maven - Build automation and dependency management
-
Serialization - Object persistence for data storage
-
Collections Framework - ArrayList & HashMap for data management
-
File I/O Operations - Data persistence with error handling
-
Main - Console user interface with menu system
-
LibraryService - Business logic layer (Service Pattern)
-
Library - Core library operations and data management
-
FileService - File operations and data persistence
-
Book - Book model with attributes and operations
-
Member - Member model with borrowing capabilities
- Prerequisites
- Java Development Kit (JDK) 21 or higher
- Maven 3.6 or higher
Basic terminal/command line knowledge
- Clone the Repository git clone https://github.com/obcodes/LibraryManagementSystem.git cd LibraryManagementSystem
- Build the Project mvn clean compile
- Run the Application mvn exec:java -Dexec.mainClass="com.obcodes.librarymanagementsystem.Main"
- Alternative: Package as JAR mvn package java -jar target/LibraryManagementSystem-1.0-SNAPSHOT.jar
When you run the application, it will:
-
Initialize the system and create necessary directories
-
Load existing data from files (if available)
-
Display the main menu
- Add New Book - Add a new book to the catalog
- Register New Member - Register a new library member
- Borrow a Book - Checkout a book to a member
- Return a Book - Return a borrowed book
- Search for a Book - Search books by title/ISBN/author
- Search for a Member - Find a member by ID
- Display All Books - View books (all/available/borrowed)
- Display All Members - View all registered members
- Show Statistics - View library statistics
- Run Tests - Run system tests (developer feature)
- Exit System - Save data and exit
LibraryManagementSystem/ ├── data/ │ ├── books.dat # Book catalog (serialized) │ ├── members.dat # Member database (serialized) │ └── backups/ │ ├── books_YYYYMMDD_HHMMSS.dat │ └── members_YYYYMMDD_HHMMSS.dat
The system automatically:
-
Creates backups before saving data
-
Keeps the 5 most recent backups
-
Can restore from backups if data is corrupted
-
ISBN Generation: Auto-generates 13-digit ISBN numbers
-
Status Tracking: Real-time tracking of book availability
-
Validation: Prevents duplicate ISBN entries
-
Safety Checks: Prevents deletion of borrowed books
-
ID Generation: Auto-generates 12-digit unique member IDs
-
Borrowing Limits: Enforces 5-book limit per member
-
Safety Checks: Prevents removal of members with borrowed books
-
Input Validation: Validates all user inputs
-
File Corruption Recovery: Attempts to restore from backups
-
Graceful Degradation: Continues operation even if some features fail
-
Automatic Saving: Saves data after every operation
-
Backup System: Maintains multiple backup versions
-
Corruption Detection: Detects and recovers from file corruption
// Automatic ISBN generation long isbn = libraryService.addNewBook("The Great Gatsby", "F. Scott Fitzgerald");
// Custom ISBN long customISBN = libraryService.addNewBook("1984", "George Orwell", 9780451524935L);
long memberID = libraryService.registerMember("John Doe"); // Returns: 123456789012 (12-digit unique ID)
boolean success = libraryService.borrowBook(memberID, isbn); // Validates: Book availability, member borrowing limit
src/main/java/com/obcodes/librarymanagementsystem/ ├── Main.java # User interface ├── services/ │ ├── LibraryService.java # Business logic │ └── FileService.java # File operations └── models/ ├── Library.java # Core library operations ├── Book.java # Book model └── Member.java # Member model
-
Service Layer Pattern - Separation of business logic from data models
-
Model-View-Controller - Separation of concerns (Console as View)
-
Singleton-like Services - Centralized service management
-
Separation of Concerns: Clear division between UI, business logic, and data layers
-
Error Handling: Comprehensive try-catch blocks with user-friendly messages
-
Input Validation: Validation at both UI and service layers
-
Documentation: Complete JavaDoc comments for all public methods
-
Code Organization: Logical package structure with clear responsibilities
This project is open source and available for educational purposes.
Obakeng Phale - Software Developer & Student
-
Java Collections Framework documentation
-
Maven documentation and community
-
NetBeans IDE for development support
This project demonstrates practical application of Java OOP principles, file I/O operations, and software design patterns in a real-world library management scenario.