When I was at the
college on 2015 at RUAHA CATHOLIC UNIVERSITY I developed a simple Java application
known as Mchepuko and I have also developing a lots of simple Java
Applications , But I have been running those application on my Editor By that
time i was interested in Eclipse, One day i asked myself what if got a client who requested for software
how can I develop and deploy my
application from editor environment to the client computer with all software
dependency you know for Java application it depend on Java runtime environment-JRE,
So I have started looking for the best application on the internet which will help me to build a windows setup
that will combine my java application and java runtime environment-JRE during software installation so that my client will not
need to install separate software like JDK or JRE for my application to run. After several days of searching on the internet
I got the solution and worked for me , So
today I have decided to share that idea to java Developers who are looking for the similar solution, I will show
step by step from source code to the
embedded setup. For this I assume you have an idea on eclipse IDE or any integrated
development environment IDE like NetBeans, IntelliJ IDEA etc.
Step 1. Make sure your
java application is running perfectly and you have tested it before building
the application to avoid rebuilding the application caused by minor errors, On
your eclipse go to file top left the click on export after clicking export the dialog
will pop up on that pop up open java folder then click Runnable JAR file see
the below screenshot
Step 2. After clicking Runnable Jar file you be redirected
to the below dialog, so on Launch configuration please select the project you
want to deploy, On export destination you suppose
to browse to where you want the deployed JAR to be saved then select “Extract
required libraries into generated JAR”
radio button and click the finish button. After clicking the finish
button the extracted JAR file will be saved to the destination folder you have
selected.
Step 3. Now you will
have a JAR file you can test to run it to confirm if working fine as you is
expected , am assuming is running fine so now you two software which Launch 4j
and smart installer maker. Launch 4j software will be used to convert
application from .jar (java application) to .exe (windows application), Launch
4J will also help to configure the bundled JRE path I mean where the application
will find the java runtime Application. below is the screenshot after launching
Launch 4j application, On JRE tab under bundled JRE path text filed you suppose
to fill the exactly path where the JRE file will be located, Note consider this
path will also be used when are building setup using smart installer maker,
under basic tab just fill the basic information like output location, select
the jar file you want to convert and if you have icon you can also select it. After
filling all the required application click on the build wrapper button to build
the .exe application.
Step 4. Now we already
have .exe application which is running on windows operating system but this application
will not run because there is no JRE on the path we have configured, so now we
will need to use smart installer maker which will help us to build a setup file
which will combine the application and the runtime environment-Jre and during installation
jre folder we be located to the path we have intended. Before we start create
the folder and within that paste .exe application we created using Launch 4j
and also paste the jre folder I prefer 32bit jre version because it will run
for both 32 and 64 bit windows Computer. See the below screenshot with
application folder that contain jre folder and .exe application. So after doing
that you to open smart installer maker to start building the setup.
Below screenshot will show how to use Smart installer
application to build the setup.
i.
Under general fill the basic information like
Product name, version, Company etc.
ii.
Under File select the folder we created that
contain .exe application and Jre folder.
iii. Under requirement tab select the version windows operating system you want
your application to support example: windows 7
iv.
Under dialog this
is where you suppose to fill the destination path, licence agreement and
password if you need your application to have a password during installation ,
on destination path you must fill the same path as you did on Launch 4J example
if the path on launch was C:\Program Files\APS\jre on smart installer the
path should be C:\Program Files\APS. And you must check enforce path checkbox to
avoid user to change the path during Software installation.
v.
After filling all those information click on
build installer to build a setup, that
setup will run on windows operating
system you have decided and there is no need to install separate Jre or JDK to
support the application to because is already embedded on the setup
Prepared
by Andason Alphonce Kilovele