create war file

SOFTWARE: java j2ee

jar -cvf appname.war *

A WAR file is a Web Archive file and is used to package up a java app for deployment to the server. I'm creating this for install as a Building Block on Blackboard. After grabbing a sample Building Block to get the file structure and making coding modifications, you need to create a WAR file of it all before uploading to the server. Here are the commands.

First, change directory so you're inside the root level of your project:

cd /Users/you/documents/code/Java/HelloWorld

Then, use the jar command to create the war file with * (all) argument to grab everything in the current directory. We're naming it "myapp.war":

jar -cvf myapp.war *

Extract Existing WAR files

Conversely, you can use the following command to extract the war files back out:

jar -xf myapp.war