Preparing a JAR File for Deployment Outside the IDE

See Also 

Whenever you build a standard Java project for which a main class is specified, the IDE automatically copies any JAR files on the project's classpath to the dist/lib folder. The IDE also adds each of the JAR files to the Class-Path element in the application JAR's manifest.mf file. This simplifies running the application outside the IDE.

Though the IDE copies the necessary files to the dist/lib directory automatically, the following special cases should be kept in mind:

Running an Application JAR Outside of the IDE

Once you have distributed the archive of your application, the application can be run outside of the IDE from the command line.

To run an application JAR file from the command line:

  1. Navigate to the project's dist folder.
  2. Type the following:
    java -jar <jar_name>.jar

When you run the jar command, the JAR tool uses the JAR manifest to determine the application entry point and the paths to the dependent binaries that are specified in the manifest.mf file.

See also
Building Tasks: Quick Reference
Building a Project
Compiling a Single File
Managing the Classpath
Customizing the Ant Build Script

Legal Notices