Wednesday, February 22, 2012

Running a desktop java application on a system which doesn't have java installed

This is an extension of my previous post where we checked how to run a desktop java application on a system where java is installed. This post discusses on how to bundle jre along with your installer so that you don't need to have java installed on client machine..

Consider that all your files required for application are saved in the following folder heirarchy.
NewFolder(any folder where in my case my folder is in C:\Users\Aparna\NewFolder)


NewFolder
           ->bin
                  ->DB
                        ->db_data(embedded db)
                  ->DeskApp.jar
                  ->Tulips.ico
           ->jre (just copy paste your jre from jdk folder which includes the bin and lib folders)


                                                                  

Note that don't enter path but the name of the file holding jre bin and lib here its jre itself.
Now you have 

NewFolder
           ->bin
                  ->DB
                        ->db_data(embedded db)
                  ->DeskApp.jar
                  ->Tulips.ico
           ->jre
           ->win.exe
           ->cfg




Now as we did in previous post use inno setup compiler for setting up installer , only thing you have to keep in mind is copy the jre into another folder within Newfolder like below.

NewFolder
           ->bin
                  ->DB
                        ->db_data(embedded db)
                  ->DeskApp.jar
                  ->Tulips.ico
           ->installer_jre
                  ->jre
           ->win.exe
           ->cfg
This folder heirarchy must be kept because it is necessary for avoiding any path issues. You can see it yourself once you finish installation and view the folders in the installed file.

Add this installer_jre file as a directory in inno setup wizard along with adding DB directory. This will do







Please try and let me know if it was helpful .Thank you have a great day!

Software License for Launch4j
Software License for InnosetUp

10 comments:

Ava joseph said...

Nice Blog. This blog is very interesting and you are provide best information for users. I always visited your blog site.Thanks for your wonderful sharing.

Liferay Development and Liferay Portal

aparna said...

Thank you for your valuable feedback.

Todaydownload.com said...

This valuable editorial was very useful to read, I savored it completely.
I'm about now to email it to my colleagues to permit them examine this too.
Thank you really
Inno Setup

kapil said...

Thank you so much Aparna
very useful blog !!

aparna said...

Thanks a lot Kapil ..

bj said...

java.sql.SQLException: Database 'C:/Users/Acer/.netbeans-derby/uol' not found.

raj rakhonde said...

hi aparna
is it possible to run exe file on other machine with database?

Shyam Agrawal said...

Hi aprna you have did amazing job.

I am developing a desktop application that uses jasper ireport for exporting pdf and excel file. so i want to know how to include these files at the time of installation and if other computer does not have jasper report install then how i can use my application there?

Anonymous said...

i cant run the installed app. :(

Naviya Nair said...

I have read your blog its very attractive and impressive. I like it your blog.

Java Online Training Java EE Online Training Java EE Online Training Java 8 online training Core Java 8 online training

Java Online Training from India Java Online Training from India Core Java Training Online Core Java Training Online Java Training InstitutesJava Training Institutes