简体   繁体   中英

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

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.setHandler(webapp);

   server.start();

EDIT:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM