Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unjar to a specific destination

Tags:

bash

terminal

jar

Is there a way to extract a jar file to a specific directory? For instance, I'm in foo directory, which contains the subfolder bar; all my jars files are at the same level at bar. So I passed the command jar xf my.jar -C bar/ However when I went to bar folder, the files were not extracted. Is there a way for me to do it without having to move the jar file to bar?

Thanks

like image 403
fabricemarcelin Avatar asked Jan 23 '12 10:01

fabricemarcelin


People also ask

How do I Unjar a JAR file?

To unpackage a JAR, you need a program that can extract compressed files. Windows includes functionality for this, but you can also use file extraction software like 7-Zip or WinRAR to get the job done. Open the JAR file within the software, and you can browse all the folders and files within it.

What is jar XVF command?

jar -xvf /Directory/File.zip. -x extract named (or all) files from archive. -v generate verbose output on standard output. -f specify archive file name. Note: The 'jar' command extracts to the current directory.


1 Answers

I don't think jar supports this, but unzip does. Try:

unzip my.jar -d bar

The behaviour is the same as the jar command, because jar files are the same as zip files.

like image 75
dogbane Avatar answered Sep 24 '22 13:09

dogbane