Home and Living Room

Gazette

intellij build jar location

IntelliJ: Locating Built JAR Files

By Robert Jones
AD

When working with Java projects in IntelliJ IDEA, it's often useful to build your application as a JAR file for distribution or testing. However, locating the generated JAR file can sometimes be a challenge, as the default location varies depending on the build configuration. Here, we provide a comprehensive guide to understanding and customizing the IntelliJ IDEA build JAR location.

Before delving into the details, let's first understand why it's essential to know the JAR location. Knowing where your JAR file is built allows you to ensure that your libraries and dependencies are included, test your application in different environments, and potentially improve your build performance.

Default JAR Location in IntelliJ IDEA

By default, IntelliJ IDEA builds JAR files in the 'out/artifacts' directory of your project's root folder. This location can vary based on your project's configuration and your IDE settings. The 'out' folder is automatically created in your project's root directory during the first build, with 'artifacts' being a subdirectory.

AD
10 Best IntelliJ Themes and Color Schemes
10 Best IntelliJ Themes and Color Schemes
an image of some sort of extractor
an image of some sort of extractor
three different colored blocks sitting next to each other
three different colored blocks sitting next to each other

Here's an example of the default JAR location:

/path/to/your/project/out/artifacts/your_project_name_jar

an image of a map with different languages
an image of a map with different languages
a poster with the words inteluli idea and some type of information on it's side
a poster with the words inteluli idea and some type of information on it's side
IntelliJ IDEA 2020.2.1 Is Available - The JetBrains Blog
IntelliJ IDEA 2020.2.1 Is Available - The JetBrains Blog

where 'your_project_name' is the name of your project.

ska meci B

The 'out' folder can contain other files and directories apart from the artifacts, such as compiled classes and resources. The 'artifacts' directory is specifically dedicated to the files generated after the build, like JAR, WAR, or EAR files.

AD

Here's how it looks in the Project Explorer view of IntelliJ IDEA:

Get Names of Classes Inside a JAR File | Baeldung
Get Names of Classes Inside a JAR File | Baeldung
a diagram showing how to use containers for containering and other things in the process
a diagram showing how to use containers for containering and other things in the process
IntelliJ GC Overhead Limit Exceeded: Ultimate Fix Guide for Developers
IntelliJ GC Overhead Limit Exceeded: Ultimate Fix Guide for Developers
Build a Local AI File Organizer 🤖 | Python, Ollama & Llama 3.2 Tutorial
Build a Local AI File Organizer 🤖 | Python, Ollama & Llama 3.2 Tutorial
a poster with the words intelilij idea in different colors and font on it
a poster with the words intelilij idea in different colors and font on it
an image of a computer screen with the text lm studio on it's side
an image of a computer screen with the text lm studio on it's side
  • Project
    • src
    • out
      • artifacts
        • your_project_name_jar

Customizing the JAR Location

IntelliJ IDEA allows you to customize the build artifacts' location to better suit your workflow. You can configure it either globally or for a specific project.

For global configuration, go to File | Settings | Build, Execution, Deployment | Build Tools | Artifacts and update the 'Output directory for artifacts' field. For project-specific configuration, select your project, go to File | Project Structure | Artifacts, and update the 'Output path' for your desired artifact.

AD

Artifact Naming

By default, the generated JAR file is named after your project, for instance, 'your_project_name.jar'. To customize the JAR name, update the 'Name' field in the 'Artifacts' configuration (File | Project Structure | Artifacts).

an image of a poster with different types of architecture and their functions in the text
an image of a poster with different types of architecture and their functions in the text

For example, if you want your JAR file to be named 'myapplication.jar', set the 'Name' field to 'myapplication'.

In conclusion, knowing and customizing the IntelliJ IDEA build JAR location is a crucial part of streamlining your Java development workflow. Whether you're looking to bundle your application for distribution or want to better integrate your builds into your CI/CD pipeline, understanding and controlling the JAR location is essential. Happy coding!"

AD
AD