Wednesday, May 20, 2009

How to create a .WAR archive

If you've worked with Java, you know exactly what I'm talking about. Java Web Archives (WAR) are the heart and soul of a Java web applications. With Linux Web Hosting, you can deploy your war archives with the following steps:

  • Upload the files to a folder in your account through FTP
  • Login to your account via SSH (I'll have to write up how to use SSH)
  • Use cd (folder) and ls commands to navigate to the folder you have your Java files
  • Execute the following command, replacing MyWebApp with the name you'd like for your .WAR archive
jar -cvf MyWebApp.war *

(this says "create (c) the new file MyWebApp.war (f) using everything in this directory (*) and list files as you add them (v)")

  • You're done!