Creating executable JAR
file without using Fat-Jar plug-in.
1. Creating an executable JAR from a Java code
& how to execute it:
o You need to create MANIFEST.MF file at the root
level with the following structure.
Manifest-Version: 1.0
Main-Class: EncryptionTest
Class-Path: bcprov-jdk16-145.jar
Manifest-Version: 1.0
Main-Class: EncryptionTest
Class-Path: bcprov-jdk16-145.jar
o where, "EncryptionTest" is main class
and "bcprov-jdk16-145.jar" is external jar used in code.
o Create JAR using:
jar -cvfm javaTest.jar MANIFEST.MF *.*
jar -cvfm javaTest.jar MANIFEST.MF *.*
To run do: java -jar
javaTest.jar
2. Compressing and unzipping files in UNIX / LINUX
machines.
1. Creating an archive and compressed/gzipped
archive using option “CVZF”
To use a gzip compression on the tar archive,
use the z option as shown below.
$ tar cvzf archive_name.tar.gz dirname/
In the above command:
• c – create a new archive
• v – verbosely list files which are processed.
• f – following is the archive file name
• z – filter the archive through gzip
Note: .tgz is same as .tar.gz
2. Extract the gzipped tar file
Use the option z for uncompressing a gzip tar archive.
Use the option z for uncompressing a gzip tar archive.
$ tar xvfz
archive_name.tar.gz
Comments