Backend Development 6 min read

How to Import Modules and Build JAR Files in IntelliJ IDEA

This step‑by‑step guide shows how to create an IntelliJ IDEA project, import a Java module into it, associate the module with the project, and then package the application into a JAR file using the IDE’s Project Structure and Artifacts settings.

Java Captain
Java Captain
Java Captain
How to Import Modules and Build JAR Files in IntelliJ IDEA

IDEA Import Project Module

1. Create an empty project

To import a Module you first need a project because modules exist under a project in IDEA.

Here we create an empty project for demonstration; if you already have a project the process is the same.

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

2. Import Module

Locate the project directory on your local disk:

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

3. Associate the Module with the current project

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

These three steps import the required Module into the project; a project can import multiple Modules.

You can also open a module directly:

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

IDEA Package Java Program into JAR

1. Select the Module to package

Click File → Project Structure → Artifacts

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

Explanation: Main Class – click the small icon to choose the class containing the main method (e.g., App).

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

Explanation: Set META-INF/MANIFEST.MF . Click the arrow icon to configure; defaults are fine.

在这里插入图片描述
在这里插入图片描述

Explanation: If an error appears, a META-INF folder already exists. Delete the existing folder via Explorer (right‑click the module → Open in → Explorer).

在这里插入图片描述
在这里插入图片描述

If no error occurs, you will see a "puzzlegame:jar" prompt. Click OK.

在这里插入图片描述
在这里插入图片描述

2. Build the JAR artifact

在这里插入图片描述
在这里插入图片描述

Click, and the following dialog appears:

在这里插入图片描述
在这里插入图片描述

3. Locate the built JAR

Click File → Project Structure → Artifacts. The generated JAR can be found at the path highlighted in the screenshot.

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
JavaIntelliJ IDEAmodule importIDE tutorialJAR packaging
Java Captain
Written by

Java Captain

Focused on Java technologies: SSM, the Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading; occasionally covers DevOps tools like Jenkins, Nexus, Docker, ELK; shares practical tech insights and is dedicated to full‑stack Java development.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.