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
From the main menu, select File | Project Structure Ctrl+Shift+Alt+S and click Artifacts.
Click , point to JAR, and select From modules with dependencies.
-
To the right of the Main Class field, click 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.
Apply the changes and close the dialog.
Build the JAR artifact
From the main menu, select Build | Build Artifacts.
-
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.