Java Tools Tutorials - Herong's Tutorial Examples - v6.23, by Herong Yang
"jar --extract" - Extracting Files from JAR File
This section provides a tutorial example on how to extract files out of a JAR file with the 'jar --extract' command.
To extract all files out of a JAR file, you can using the "jar --extract --file ..." command.
herong> del Hello.class herong> jar --extract --verbose --file hello.jar created: META-INF/ inflated: META-INF/MANIFEST.MF inflated: Hello.class
Or use the old short formats:
herong> jar xvf hello.jar created: META-INF/ inflated: META-INF/MANIFEST.MF inflated: Hello.class herong> jar -x -v -f hello.jar created: META-INF/ inflated: META-INF/MANIFEST.MF inflated: Hello.class
To verify the command output, I deleted Hello.class before and checked the extracted files after:
herong> dir Hello.class 416 Hello.class herong> dir META-INF 66 MANIFEST.MF herong> type META-INF\MANIFEST.MF Manifest-Version: 1.0 Created-By: 12.0.1 (Oracle Corporation)
Notice that two attributes, "Manifest-Version" and "Created-By" were used in the manifest file created by the "jar --create" command.
Table of Contents
javac - The Java Program Compiler
java - The Java Program Launcher
JAR - Java Archive File Format
jar - JAR File Tool Command and Options
"jar --create" - Creating New JAR File
"jar --list" - Listing Files in JAR File
►"jar --extract" - Extracting Files from JAR File
Managing JAR Files with WinZIP
META-INF/MANIFEST.MF - JAR Manifest File
Adding META-INF/MANIFEST.MF to JAR Files
"jar -C" - Changing Input Directory
Using JAR Files in Java Class Paths
"jar --update" - Updating Class Files in JAR
"jar --main-class" - Making JAR File Executable
"jar --module-version" - Updating Module Version in JAR
jpackage - Binary Package Builder
javadoc - The Java Document Generator
jdeps - The Java Class Dependency Analyzer
jdeprscan - The Java Deprecated API Scanner
jcmd - The JVM Diagnostic Tool
jconsole - Java Monitoring and Management Console
jstat - JVM Statistics Monitoring Tool
jhsdb - The Java HotSpot Debugger
jvisualvm (Java VisualVM) - JVM Visual Tool
javap - The Java Class File Disassembler
keytool - Public Key Certificate Tool
jrunscript - Script Code Shell
native2ascii - Native-to-ASCII Encoding Converter