Creating Java Jar File Artifact in Intellijidea IDE

Creating Java Jar File Artifact in Intellijidea IDE:

Video Tutorial:


This is an independent tutorial. The code is from this tutorial Java Relative Path Resource Loading using URL class. It is not necessary to use this code, any project will work. Here in this tutorial I package the java files and other resources such as sound files to a jar file or an Intellijidea artifact for this project.


 

Text Version of the Tutorial:

In intellijidea an artifact is an output of a project or module. So for our java project our project output is a jar file. So the jar file is the artifact in this project.

 

  1. initial Screen from last tutorial
    initial Screen from last tutorial

     

  2. Go to File -> Project Structure -> Artifacts
  3. artifacts project structure settings
    artifacts project structure settings
  4. Now Select the Plus or Add Sign and click on Jar -> From Modules with Dependencies.
  5. jar artifact settings
    jar artifact settings

     

  6. Now select Main class for your jar file like shown below. The main class is the class with your main method, the entry point for your jar application.
  7. select main class
    select main class
  8. Click ok on eveything else and exit out of project structure dialog.
  9. Now click on the menubar Build->Build Artifacts->Build like shown below.
  10. build jar artifacts
    build jar artifacts
  11. Now see on the left side in the projects area there is a new directory called Out -> Artifacts -> YourProjectName_Jar -> JarFileName.jar
  12. locate jar artifact file
    locate jar artifact file

 

3 thoughts on “Creating Java Jar File Artifact in Intellijidea IDE

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s