Create JAR Files in Java

Console or command prompt is used to create JAR files.

Command for creating JAR

jar cf jar-file-name.jar File(s)_to_add

where,

Example

jar cf myJar.jar Music.class Equalizer.class song.mp3

Output

A JAR file is created in the current folder with Music.class, Equalizer.class, song.mp3 and a default MANIFEST.MF File which contains information about jar files inside a directory META-INF.


Other commands