Tuesday, 26 August 2008

Laucher for Java desktop application



Launching my Java desktop application in windows environment just by mouse clicks, this was my requirement. In my normal approach, where in which I have an application jar file and a couple of other supporting libraries, the command line invoking was quite annoying. This is because I may use a .bat file, and running this will open up a window, and I don't really want all these to happen.
So I have started searching and ended up with evaluating Launch4j (http://launch4j.sourceforge.net/), a pretty good tool for my needmake a launcher application. This tool can be used to wrap applications on Windows, Linux, Mac OS X and Solaris and available under BSD license.

In my case, I was quite lucky, because all the required jar files (application and libraries), JRE etc are available in same location in all machines. So I have to just make the launcher .exe and distribute ...

(1) Make all libraries available (Say under folder c:), and lauch the Launch4j
(2) Fill in the required details under `Basic` tab.

(3) Fill in the details under the `Classpath` tab

(4) If we need to run the application as a single instance, provide the details under `Single instance` tab

(5) Specify any JRE related configurations under `JRE` tab

(6) Click on the Build Wrapper button from the top,

This will create a configuration file (xml) and an exe file which is going to be the launcher.

No comments: