FreeKB - Linux Commands View and create a Java archive using the JAR command in Linux
Linux Commands - View and create a Java archive using the JAR command in Linux

If Java is not installed, use apt-get or yum to install Java.

yum install java-devel

 


CREATE

The jar command can be used to create a jar (java archive) file. Let's take an example where the /var/www/html directory contains some HTML, CSS, and JS files. The following command will create a war file named MyWebArchive.jar that contains all of the files at and below /var/www/html.

[john.doe@server1 ~]# jar -cvf example.jar /var/www/html
added manifest
adding: var/www/html/index.html(in = 0) (out = 0) (stored 0%)
adding: var/www/html/about.html(in = 0) (out = 0) (stored 0%)
. . .

 


VIEW CONTENTS

The jar command with the t (table) and f (file) options can be used to display the contents of the jar file.

[john.doe@server1 ~]# jar -tf example.jar
META-INF
META-INF/MANIFEST.MF
/var/www/html
/var/www/html/index.html
/var/www/html/about.html
. . .

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter 6081f in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |