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

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail:

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap