Bootstrap FreeKB - Java - Create a JAR file on the command line
Java - Create a JAR file on the command line

Updated:   |  Java articles

The JAR command is include in some, but not all installations of Java. On a Linux system, the which command can be used to determine if the JAR command is part of your $PATH. If something like this is returned, you may need to install Java on your Linux system.

~]# which jar
/usr/bin/which: no jar in (/sbin:/bin:/usr/sbin:/usr/bin)

 

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 JAR file named example.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%)

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


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