Create a JAR file in IntelliJ IDEA

Sarang Surve
2 min readApr 1, 2023

--

Creating a JAR file in IntelliJ IDEA can seem like a daunting task, but with the right steps, it’s quite simple. In this post, we’ll go through the steps to create a JAR file in IntelliJ IDEA.

Step 1: Open the “Project Structure” dialog window
The first step is to open the “Project Structure” dialog window. To do this, navigate from the main menu to File and then Project Structure.

Ctrl+Alt+Shift+S

Step 2: Add a JAR artifact
Once you have the “Project Structure” window open, navigate to Artifacts under Project Settings and click on the add button (+ sign). From the dropdown menu, select JAR and then choose “From modules with Dependencies” to create a new JAR artifact.

Step 3: Select the Main class
In the “Create JAR from Modules” window, select the Main class and then click OK to close the window.

Step 4: Check the output directory
Back in the “Project Structure” window, check the output directory path to ensure your JAR file is being generated in the correct location.

Step 5: Build the JAR file
Finally, go to Build and then Build Artifacts. In the “Build Artifacts” dialog window, click on “Build” to generate your JAR file. You can now find your JAR file in the output directory you noted in step 4.

And that’s it! With just a few simple steps, you can easily create a JAR file in IntelliJ IDEA. Happy coding!

--

--

No responses yet