From https://dzone.com/articles/java-8-how-to-create-executable-fatjar-without-ide

tar xf ExecutableOne.jar

but why do I get

$ tar xf ExecutableOne.jar 
tar: This does not look like a tar archive
tar: Skipping to next header
tar: Exiting with failure status due to previous errors


  • 1
    Because jar files are not tar archives, and it's utterly bewildering to me that that article suggests they are. – Michael Homer Apr 11 '19 at 20:35
  • 5
    This is probably a typo in the article, which really meant to say jar xf rather than tar xf. – dhag Apr 11 '19 at 20:37
  • 3
    They are just zip files, though, so you can extract them with unzip too. – Michael Homer Apr 11 '19 at 20:58
  • @MichaelHomer Can tar extract zip files? – Tim Apr 11 '19 at 21:03
  • I wouldn’t be surprised if there were an implementation that could, but not usually. – Michael Homer Apr 11 '19 at 21:13

A jar file is a Java ARchive, not a tarball that can be extracted. You can install jar or java and extract the files (or use 7-Zip), but you can't extract them with tar.


bsdtar (which is the regular tar(1) on FreeBSD, and easily installable on Linux) can extract .jars transparently, and a lot of other archive formats.

.jars are basically .zip files.


IF you are old enough to remember, it USED to work (at least on Solaris) just fine: you could use tar to enumerate and extract the contents of a .jar file. It was extremely handy for double checking for the presence of specific .class files on a target system, where you typically didn't have developer tools deployed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.