Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unpack war to a directory using jar command.is that possible?

I've search online a way to unpack a war file from a location to a different one, and so far nothing satisfactory. i use this command

jar -xvf mysite.war -C /usr/local/tomcat/webapps/mysite/

it's not working.this :

jar -xvf mysite.war /usr/local/tomcat/webapps/mysite/

is not throwing any error but still not working any idea?

like image 592
black sensei Avatar asked Dec 10 '22 12:12

black sensei


2 Answers

Found the blog post at mkyong.com

As stated there: "...jar does doesn’t has option to extract files to another folder directly..." So what you need to do is change to the directory you want to extract to, and then refer the jar-file from there

mkdir newdir
cd newdir
jar -xvf /workspace/test/classes/test.jar

This will do the trick for you on Windows as well, since unzip is not available there by default.

like image 99
rhellem Avatar answered Mar 05 '23 16:03

rhellem


A war file is a zipped archive. Perhaps using unzip will work.

like image 26
darioo Avatar answered Mar 05 '23 14:03

darioo