Skip to content

oracle002/DownloadManager

Repository files navigation

🛠️ SMART IDM Console Application Setup This project is a multi-threaded console-based download manager that utilizes multithreading for concurrent downloading and a MySQL database to log download history.

STEP 1: Database Setup (MySQL) The DBI.java class requires a running MySQL server for persistent history logging.

Create the Database: Log into your MySQL server and create a database named idm.

SQL

CREATE DATABASE idm; USE idm; Create the Download History Table: Execute the following SQL to create the download table used for logging.

SQL

CREATE TABLE download ( id INT AUTO_INCREMENT PRIMARY KEY, url VARCHAR(2000) NOT NULL, file_name VARCHAR(255), size BIGINT, start_time TIMESTAMP, end_time TIMESTAMP, success BOOLEAN ); Verify Connection Details: The DBI.java file is configured for default local settings (root, no password). If your MySQL configuration is different, please update the following lines in DBI.java:

private static final String DB_USER = "root";

private static final String DB_PASS = "";

STEP 2: Dependencies and Compilation You need the MySQL Connector/J library for the DBI class to function.

Download Connector/J: Download the latest MySQL Connector/J JAR file (e.g., mysql-connector-j-x.x.x.jar).

Compile the Java Files: Compile all three .java files, making sure to include the Connector/J JAR in your classpath. Replace path/to/mysql-connector-j.jar with your actual file path.

Bash

On Linux/macOS:

javac -cp .:path/to/mysql-connector-j.jar ConsoleIDM.java DBI.java DownloadThread.java

On Windows:

javac -cp .;path/to/mysql-connector-j.jar ConsoleIDM.java DBI.java DownloadThread.java STEP 3: Running the Application You must provide the target URLs as command-line arguments when starting the program.

Execute the Main Class: Run the ConsoleIDM class, again including the Connector/J JAR in the classpath, followed by one or more valid download URLs.

Bash

Example command to run the application:

java -cp .:path/to/mysql-connector-j.jar ConsoleIDM https://speed.hetzner.de/100MB.bin https://example.com/data.zip Start Downloads: Select Option 1 from the main menu to initiate the multi-threaded download for the URLs provided in the command line.

STEP 4: Interaction and History The main menu allows you to control the downloads and view records.

Pause/Resume: Select Option 3 from the main menu to toggle the pause state for all active downloads.

The threads will suspend when the download is paused and resume their progress when unpaused.

View History: Select Option 2 from the main menu. This will connect to the MySQL database and display a neatly formatted table of all past and completed (or failed) download attempts logged by the application.

About

Simple Download Manager Using JAVA

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages