You can extract all or some entries from a JAR file using the option x.
To extract all entries from a test.jar file, you use
jar xf test.jar
The option x extracts the entries from the JAR file.
The option f sets the file name, which is test.jar.
The above command will extract all entries from test.jar file in the current working directory.
It will create the same directory structure as it exists in the test.jar file.
The JAR file test.jar is unchanged by the above command.
To extract individual entries from a JAR file, list them at the end of the command.
The entries should be separated by a space.
The following command will extract A.class and book/HelloWorld.class entries from a test.jar file:
jar xf test.jar A.class book/HelloWorld.class
To extract all class files from a book directory, you can use the following command:
jar xf test.jar book/*.class
Use the option t with the jar command to list the table of contents of a JAR file on the standard output.
jar tf test.jar