How to extract Java Jar/War/Ear files in Linux

If you have Java Archive files such as jar, war, or ear and you want to extract them using the Linux command then make use of the jar command.

.jar - Java Archive File
.war - Java Web Archive File
.ear -Enterprise Java Archive File

Command to extract Java .jar file

# jar -xvf /path/to/file/fileName.[war|ear|jar]

# jar -xvf myApp-uat-2.0.1-SNAPSHOT.war

Make sure you have Java JDK installed on the system to use this command, or else you will get an error.

# jar -xvf my-production-2.0.1-SNAPSHOT.ear
The operation couldn’t be completed. Unable to locate a Java Runtime.
Extract Jar War Ear Java Files using Command

Have Questions? Post them here!

Top Hashtags: