TAGS :Viewed: 17 - Published at: a few seconds ago

[ standalone war / java web application ]

i have prepared a web application using netbeans, i want to share this with the client where he can unzip folder and has an icon to click and start using it , how can i achieve this where run time environment or anything that is required by a web application get packaged as a zip to download and run on any computer.

i have checked the below link but it doesnt help much as there is no maven used :

http://www.javacodegeeks.com/2012/11/standalone-web-application-with-executable-tomcat.html

Answer 1


You need to use a embedded server like jetty.

  1. Create a main method.
  2. Create manifest file.
  3. Bundle them into an executable jar.

These steps are explained here.

In the main method you need to start jetty programmatically and add the wars to it.

   Server server = new Server(8088);

   WebAppContext webapp = new WebAppContext();
   webapp.setWar("location to war");
   webapp.setContextPath("/contextpath");
   server.addHandler(webapp);

   server.start();

EDIT:

To bundle java runtime, a cleaner approach would be using JNLP.