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

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

Example:
# 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 is a seasoned developer with over 10 years of experience in web and app development, and a deep knowledge of operating systems. Author of insightful How-To articles for Code2care.

Follow him on: X

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