IntelliJ IDEA 2019.3 Help

Package your application in a JAR

When the code is ready, you can package your application in a Java archive (JAR) so that you can share it with other developers. A built Java archive is called an artifact.

Create an artifact configuration for the JAR

  1. From the main menu, select File | Project Structure Ctrl+Shift+Alt+S and click Artifacts.

  2. Click the Add button, point to JAR, and select From modules with dependencies.

  3. To the right of the Main Class field, click the Browse button and select the main class in the dialog that opens (for example, HelloWorld (com.example.helloworld)).

    IntelliJ IDEA creates the artifact configuration and shows its settings in the right-hand part of the Project Structure dialog.

  4. Apply the changes and close the dialog.

Build the JAR artifact

  1. From the main menu, select Build | Build Artifacts.

  2. Point to the created .jar (HelloWorld:jar) and select Build.

    If you now look at the out/artifacts folder, you'll find your .jar file there.

The JAR artifact is built
Last modified: 12 December 2019