How to make jar file in intelliJ idea

How to make a jar file in IntelliJ idea

Jar files are used to package Java code as an executable JAR file. Jar files are typically used for programs that need to be run on command line, such as Java applications.

To create a jar file in IntelliJ Idea, follow these steps:

1. Go to project structure

2. Create a new artifact

3. Select the main class, and be sure to change the manifest folder:

4. Change the manifest directory:

<project folder>\src\main\java 

replace “java” with “resources

<project folder>\src\main\resources

This is what it should look like:

  • Then you choose the dependencies that you want to be packed in your jar, or NEAR your jar file

5. Build Artifact

  • To build your artifact go to build artifacts and choose “rebuild“. It will create an “out” folder with your jar file and its dependencies.

Add a Comment

Your email address will not be published. Required fields are marked *