How to Create a JAR File (From a Folder, With the jar Command)

Create a JAR file from a folder of classes. Use the jar command, make it executable with a Main-Class, build a runnable JAR, or repackage one online.

Before You Start: You Need Compiled Classes

Step 1: Create a Basic JAR (`jar cf`)

Step 2: Make It Executable (Add a Main-Class)

Step 3: Update an Existing JAR (`jar uf`)

No JDK? Repackage Online

Bundling Dependencies (Fat JAR)

Summary