Java USES the command line to package jars

  • 2020-04-01 02:27:48
  • OfStack

1. Command line:
packaging
Jar cf jar file name program file name or folder where the program resides
For example:
The jar cf MyApp. Jar D: JavaProjectMyApp
View the contents of a jar file
Jar TVF jar file name
For example:
The jar TVF MyApp. Jar
Unzip a jar file
Jar xf jar file name
For example:
The jar xf MyApp. Jar
Add files to the zip package
Jar xf jar file name added to the file or other jar files
For example:
The jar xf MyApp. Jar Test. Class
Update a jar file
Jar uf the file whose jar file name is updated or another jar file
For example:
The jar uf MyApp. Jar Test. Class
Run a jar program
Java-jar jar file name
For example:
Java - jar MyApp. Jar
Create a running jar file
First we have to have a Main Class
Create a text called manifest.mf and copy it in
The Manifest - Version: 1.0
The Main - Class: YourMainClass
This YourMainClass is the same class that contains the main method in your program
The following statement is used to create an executable jar file.
Jar CVFM myapp. jar manifest.mf file or folder path

Related articles: