How to Create a .Jar File or Export Jar in Intellij Idea (Like Eclipse Java Archive Export)

How to build JARs from IntelliJ properly?

Here's how to build a jar with IntelliJ 10 http://blogs.jetbrains.com/idea/2010/08/quickly-create-jar-artifact/

File -> Project Structure -> Project Settings -> Artifacts -> Click green plus sign -> Jar -> From modules with dependencies...

Select a Main Class (the one with main() method) if you need to make the jar runnable.

The above sets the "skeleton" to where the jar will be saved to. To actually build and save it do the following:

Extract to the target Jar

OK

Build | Build Artifact | Build

Try Extracting the .jar file from

ProjectName | out | artifacts | ProjectName_jar | ProjectName.jar

Compile package to library .jar

If you create a plain Java module for your code, the build process will automatically create a jar of it and put it in the build/libs directory. If you want more explicit control over jar file generation, you can read about the Java plugin's jar task at http://www.gradle.org/docs/current/userguide/java_plugin.html

Correct way to add external jars (lib/*.jar) to an IntelliJ IDEA project

dialogue in Intellij 20.3

Steps for adding external jars in IntelliJ IDEA:

  1. Click File from the toolbar
  2. Select Project Structure option (CTRL + SHIFT + ALT + S on Windows/Linux, + ; on Mac OS X)
  3. Select Modules at the left panel
  4. Select Dependencies tab
  5. Select + icon
  6. Select 1 JARs or directories option


Related Topics



Leave a reply



Submit