Modifying a Manifest File

The u option is covered in the section called Updating a JAR File.
jar cmf manifest-addition jar-file input-file(s)
The options and arguments used in this command:

Example

To indicate which class is the project's entry point, add a Main-Class header to the JAR file's manifest. The header takes the form:

Main-Class: classname
The header's value, classname, is the name of the class that's the project's entry point.
Main-Class: Main
jar cmf manifest-addition <project_name>.jar class
where class is the directory with your class files.
java -jar <project_name>.jar

Warning: The manifest text file must end with a new line or carriage return.

Exercise

  1. Make a file indicating that teamname.projectname.Main is the entry point for your project.
  2. Modify the jar command that creates the projectname.jar so that it includes this manifest information.
  3. Give a command to run your project, given the projectname.jar file.