Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create Java webapp installer (.exe) that includes Tomcat and MySQL?"

How to create a installer using Java that combine tomcat, mysql and war file and come out a final exe?

like image 390
Wilson Avatar asked May 13 '09 08:05

Wilson


People also ask

How many ways we can deploy application in Tomcat?

A web application can be deployed in Tomcat by one of three different approaches: Copy unpacked directory hierarchy into a subdirectory in directory $TOMCAT_HOME/webapps/ . Tomcat will assign a context path to your application based on the subdirectory name you choose. We will use this technique in the build.


2 Answers

You could use any installer, really. I personally have used InnoSetup, which is quite simple, but can still perform almost any task at installation time.

In your case, you probably want to place the Tomcat files somewhere, webapp included. Customize some configuration files and run the MySQL installer in silent mode. All of which is perfectly possible with InnoSetup.

If you need more flexibility, you can look at NSIS, another very simple but very powerful installer app.

like image 98
Gerco Dries Avatar answered Nov 06 '22 22:11

Gerco Dries


The possible options have been largely covered in several questions already, especially:

  • What’s the best way to distribute Java applications?
  • What is the best installation tool for java?
  • What are good InstallAnywhere replacements for installing a Java EE application?

...and other questions tagged java + installer

Although admittedly some options mentioned in those questions cannot produce self-sufficient .exe installers. If a commercial tool is ok for you, I can personally recommend install4j (costs $); among other things, it can create .exe installers (details about my experiences with it). Or, for a simpler, free tool for producing Windows executables out of Java programs, see Launch4j.

Update of my install4j recommendation, based on this comment by OP:

Yes, the exe installer need to install the tomcat, mysql, web application, and db script all in once. At the end, users only need to start the tomcat and mysql service. Go to browser can access the web application.

With install4j,

  • you can bundle Tomcat, MySQL and your webapp just fine
  • you can automatically start the services too from the installer (or leave it to users as you suggest)
  • if you want, the installer can even directly launch the browser and point it to your webapp :-)

I have just done a similar thing with install4j (bundle application server, webapp, run database scripts, and many other things; without bundling the database however), so I'm relatively sure it can be done. I do not know if you can do this (easily) with the free tools such as Launch4j.

like image 32
Jonik Avatar answered Nov 06 '22 23:11

Jonik