Java – How do I update a jar file after a list file and lib folder change?

How do I update a jar file after a list file and lib folder change?… here is a solution to the problem.

How do I update a jar file after a list file and lib folder change?

I have hadoop-1.0.3 .jar. I made some changes to the lib folder (add external jar) and list files, and now I want to rebuild the jar file with the name hadoop-1.0.4.jar.
How can I do this?

Solution

In the shell, run:

jar cvfm hadoop-1.0.4.jar manifest.txt [list of files to package into a jar file].

You can run jar --help in the shell to check the different options available.

Basically, this particular command means:

-c: Creates a new jar file.

-v: Verbose output.

-f: Specifies the packaged file name.

-m: Contains the list file.

The rest should be easy to understand (output name, list file, list of files to package).

Related Problems and Solutions