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

Free Resources

Copyright ©2024 Educative, Inc. All rights reserved