Create war file in command prompt

How to create a war file in the command prompt.
You can follow the directions below for Windows command prompt or for the Mac OSX terminal.

To compress a “michael” Java web application into a web archive file named michael.war. Follow these steps.

Prerequisites

  • J2SE installed, with jar in your environment path.
    1. Open the command prompt and cd to your directory that you want to archive.
      <tomcat_home>\webapps\michael
    2. Use the Java Archive Command “jar” to bundle up the application
    3. jar -cvf michael.war *
    4. After finishing, you will see a michael.war file in that directory.

    One of the books I highly recommend is Clean Code. It's Java centric but has helped me throughout my professional career. The book is still sitting on my bookshelf.