What are JAR files in Java?

A JAR file is simply the compressed version of Java class files and all the subsidiary resources like (image files, audio files, etc.). It is more of an archived package file that can be unarchived very easily using any tool (e.g., WinZip). JARs have the jar extension.

Remember: All Java files (*java) are usually converted into a single jar file.

Commands

commands meaning
cf It converts the specified file into a jar file.
tf It is used to view the contents of a jar file.
xf It is used to extract all the contents of a jar file.
-jar It is used to run the jar file.

Illustration

1 of 5
New on Educative
Learn to Code
Learn any Language as a beginner
Develop a human edge in an AI powered world and learn to code with AI from our beginner friendly catalog
🏆 Leaderboard
Daily Coding Challenge
Solve a new coding challenge every day and climb the leaderboard

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved