This is a simple Car Rental Management System desktop application built with Java Swing and MySQL.
- Java Development Kit (JDK) 8 or later
- MySQL Server
- Start your MySQL server.
- Create a new database named
car_rental_system. You can use the following SQL command:CREATE DATABASE car_rental_system;
- Use the newly created database:
USE car_rental_system;
- Create the necessary tables. The
database_setup.sqlfile is missing thecarstable definition. Run the following SQL command to create thecarstable:CREATE TABLE cars ( car_id VARCHAR(255) PRIMARY KEY, brand VARCHAR(255) NOT NULL, model VARCHAR(255) NOT NULL, base_price_per_day DOUBLE NOT NULL, is_available BOOLEAN NOT NULL );
- Run the
database_setup.sqlscript to create thecustomersandrentalstables. - (Optional) Populate the
carstable with sample data by running theinsert_150_cars.sqlscript.
- Open the
DatabaseManager.javafile. - If your MySQL root password is not
root, change theDB_PASSWORDconstant to your MySQL password:private static final String DB_PASSWORD = "your_password"; // Change this to your MySQL root password
Open a terminal or command prompt in the project's root directory (d:\G4_CarRantalManagementSystem) and run the following command to compile the Java source files. This command includes the MySQL connector JAR in the classpath.
javac -cp "mysql-connector-j-9.4.0.jar" *.javaAfter successful compilation, run the application using the following command. This command also includes the MySQL connector JAR and the current directory in the classpath.
java -cp ".;mysql-connector-j-9.4.0.jar" MainThe Car Rental System GUI should now appear.
The application has a simple admin login to add new cars.
- Username: admin
- Password: 12345








