intellij-idea

Exporting

Building a .jar

Eventually, when you’re ready to release a version of your code to production, you’ll need a .jar file to distribute. Intellij makes building JARs quite easy.

First, navigate to File -> Project Structure and click on Artifacts: Artifacts

Click on the + button, and select JAR -> From modules with dependencies: enter image description here

Select your module from the dropdown list, and the main file (this is the file that contains your public static void main() method): enter image description here

Click OK, verify that all the information regarding dependencies is correct, and click OK to finish setting up the artifact. enter image description here

We’re not done yet! We’ve only told Intellij how to build the artifact, now we actually need to make the .jar.

Simply click Build -> Build Artifacts, and click Build on the popup menu: enter image description here

The jar will be found in build -> classes -> artifacts


This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow