Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

java

How to print the list of classes present in the jar

Programming Bytes

Overview

We can use the jar command with the option tf in the terminal to list the contents of the jar file.

Syntax

jar tf jarname.jar

In the above command:

  • t: This represents the lists of the contents of the jar file.
  • f: This represents that the contents of the jar file to be viewed are specified on the command line.

The option t and f can be in any order (either tf or ft, both denote the same). The option should not have a space in between them.

If we need to print the additional details like size and last modified time of the file, we can use the v option.

jar tvf jarname.jar

Code example

Let's run the below commands:

  • jar tf java-json.jar
  • jar tvf java-json.jar
Terminal 1
Terminal

RELATED TAGS

java
RELATED COURSES

View all Courses

Keep Exploring