Skip to main content
MegaDownloader is a Java Swing GUI application for downloading videos and audio from YouTube using yt-dlp. This guide will walk you through installing all prerequisites and building the application.

Prerequisites

Before installing MegaDownloader, ensure you have the following installed on your system:
1

Java 24 or higher

MegaDownloader requires Java 24 as specified in the pom.xml configuration:
<properties>
    <maven.compiler.release>24</maven.compiler.release>
</properties>
Verify your Java installation:
java -version
If you need to install Java 24, download it from the Oracle JDK website or use your system’s package manager.
2

Apache Maven

Maven is required for building the project and managing dependencies.Verify Maven is installed:
mvn -version
If not installed, download it from the Maven website.

Required External Tools

MegaDownloader relies on two external tools for downloading and processing media:
1

Install yt-dlp

yt-dlp is the core download engine used by MegaDownloader.
  1. Download the yt-dlp executable from the official repository:
  2. Place yt-dlp.exe (Windows) or yt-dlp (Linux/Mac) in a known directory
  3. Note the full path - you’ll need this during first-time configuration
The application stores this path in config.txt and reads it using the getYtDlpPath() method from MainPanel.java:174.
2

Install FFmpeg (Required for audio extraction)

FFmpeg is essential for extracting audio from videos and converting formats.
  1. Download FFmpeg from:
  2. Extract the archive and locate ffmpeg.exe and ffprobe.exe (or the non-.exe versions on Unix systems)
  3. Important: Place both executables in the same directory as yt-dlp
MegaDownloader automatically detects FFmpeg when it’s in the same directory as yt-dlp using the hybrid detection system in MainPanel.java:222-254:
private String getFfmpegLocation() {
    String ytdlpPath = getYtDlpPath();
    if (ytdlpPath != null) {
        File ytdlpFile = new File(ytdlpPath);
        File ytdlpDir = ytdlpFile.getParentFile();
        
        if (ytdlpDir != null) {
            File ffmpegExe = new File(ytdlpDir, "ffmpeg.exe");
            File ffprobeExe = new File(ytdlpDir, "ffprobe.exe");
            
            if (ffmpegExe.exists() && ffprobeExe.exists()) {
                return ytdlpDir.getAbsolutePath();
            }
        }
    }
}
If you attempt audio extraction without FFmpeg, you’ll see a warning dialog (MainPanel.java:524-537) prompting you to install it.

Building the Application

Once all prerequisites are installed, build MegaDownloader from source:
1

Clone or download the source code

Navigate to the project directory:
cd /path/to/megadownloader
2

Compile with Maven

Compile the project and resolve dependencies:
mvn clean compile
This command:
  • Downloads all dependencies (FlatLaf, Jackson, custom components)
  • Compiles Java sources from src/main/java/com/borjaalmazan/entrega1_1/
  • Validates the build configuration
3

Package as JAR (Optional)

Create an executable JAR with all dependencies:
mvn package
The Maven Shade plugin will create an uber-JAR at target/megadownloader-1.0-SNAPSHOT.jar with the main class set to com.borjaalmazan.entrega1_1.Main.
4

Run the application

Run directly with Maven:
mvn exec:java
Or run the packaged JAR:
java -jar target/megadownloader-1.0-SNAPSHOT.jar

First-Time Configuration

When you first launch MegaDownloader, you’ll need to configure the yt-dlp path:
1

Configuration prompt

On first launch, you’ll see this dialog (Main.java:124-133):
if (!configFile.exists()) {
    JOptionPane.showMessageDialog(this,
        "No configuration found.\n" +
        "To be able to use the app, please go to Edit > Preferences to set the yt-dlp path.",
        "Configuration Required",
        JOptionPane.INFORMATION_MESSAGE);
}
2

Set yt-dlp location

  1. Click Edit > Preferences in the menu bar
  2. Click Change location button
  3. Navigate to and select your yt-dlp.exe file
  4. The path will appear in the preferences panel
3

Set download directory (Optional)

By default, files download to the project directory. To change this:
  1. In Preferences, click Change Download directory
  2. Select your preferred download folder
  3. This path is stored in config.txt as downloadDir:"/your/path"
4

Save configuration

Click Save to write settings to config.txt:
path:"C:\tools\yt-dlp.exe"
downloadDir:"C:\Users\YourName\Downloads"
The configuration file is read by PreferencesPanel.java:127-151 on startup and persists between sessions.

Manual FFmpeg Configuration

If FFmpeg is installed in a different location than yt-dlp:
  1. Open config.txt in a text editor
  2. Add the FFmpeg path:
path:"C:\tools\yt-dlp.exe"
downloadDir:"C:\Users\YourName\Downloads"
ffmpegPath:"C:\ffmpeg\bin"
  1. Save and restart the application
The application will check this manual path as a fallback (MainPanel.java:239-250).

Verifying Installation

To verify everything is set up correctly:
  1. Launch MegaDownloader
  2. Log in with your credentials
  3. Go to Edit > Preferences
  4. Confirm the yt-dlp path is displayed (not “Not configured”)
  5. Try downloading a test video to confirm functionality

Dependencies

MegaDownloader uses the following libraries (automatically managed by Maven):
  • FlatLaf 3.6.2 - Modern dark theme for the UI
  • Jackson 3.0.0 - JSON parsing for API communication
  • Custom MediaPollingComponent - API integration for media management
These are defined in pom.xml:14-30 and downloaded automatically during the build process.

Troubleshooting

If you encounter issues during installation:
  • Ensure Java 24+ is properly installed and in your PATH
  • Verify yt-dlp is executable and not blocked by antivirus
  • Place FFmpeg executables directly in the yt-dlp directory for auto-detection
  • Check file permissions if configuration fails to save
  • Review console output for detailed error messages

Next Steps

Now that MegaDownloader is installed and configured, proceed to the Quickstart Guide to download your first video.

Build docs developers (and LLMs) love