We have already discussed about creating an embedded derby database .For those who are here for the first time check this first so that it might be easier. So before coming to packaging first we will create a desktop application in java with netbeans as an example for checking the packaging issues.
First we need an embedded db for creating this application .I am not elaborating as we have discussed it in my previous post in detail. It is necessary to have at-least 1 column set as primary key.For example create a database named db_data with 1 table named as table1 with 2 columns col1 and col2. Let col1 be set to primary key. After all this insert 2 rows into it and disconnect the db . If you already have an embedded db create a skelton of it in netbeans and with that create the desktop application. Later while including the db include your desired db file along with exe file.
Creating the sample desktop application
From File->New Project->under Java->choose Java Desktop Application.
Click next and give a project name for instance 'DeskApp' is our project.
Under Choose application shell choose database application and click next.
Select the database url you just created and under cloumns to include choose all columns(we have only 2 columns now you can change it according to your need), click next and finish.
Now you have your DeskApp in the projects window.
Right click on DeskApp and select Clean and build. After this choose Files where you will see the files and libraries included in your application. There is a dist folder which contains your jar and lib files .This is created while you build your project.
Normally the jar file is only necessary to launch an application. But here we have dependent lib folder and the database file which should be included so first we package the lib into the jar folder created so that we have a single jar and the database file. For this, you will see a build.xml file under your project . In this xml code, just before closing </project> paste the code in the below site.
For reading about this further check this site.
(change the line in the above code to name of your project <property name="store.jar.name" value="DeskApp"/> now that it is DeskApp)
Save your project and right click build.xml->RunTarget->OtherTarget->package for storage as seen in the screen shot in here
![]() |
project files |
This is what we need for packaging.
Creating an exe file for your jar file
Download and install any converter that does this. I used Launch4j for this purpose which is an open source software. Once you have downloaded and installed launch4j start it on your PC. Before beginning, create a NewFolder and copy your jar file (in the store folder of your project) and your db_data file (after disconnecting from netbeans move to the folder containing your embedded db file and copy this file to newly created folder under another folder say DB) into it. If you like to have an icon, add any icon file(.ico format). You can convert it here.
Now you have
NewFolder
-> DeskApp.jar
-> DB
->Tulips.ico
Once you start your launch4j , under the Basic tab, browse for output file and save it for instance win.exe.(eg ..\NewFolder\win.exe)
Browse for the jar file you copied just now(DeskApp.jar under NewFolder) in *jar. In the icon field browse and choose your icon. You can leave all other fields empty .
Now jump to the jre tab and fill the minimum jre version say 1.4.0(as you want it to be) and select the Build Wrapper tool on top .
Once you select this give a name say config for the file to be saved. When your log says succesfully created the file select the Test wrapper next to Build Wrapper .Now you have your exe file in the folder you selected
Browse for the jar file you copied just now(DeskApp.jar under NewFolder) in *jar. In the icon field browse and choose your icon. You can leave all other fields empty .
Now jump to the jre tab and fill the minimum jre version say 1.4.0(as you want it to be) and select the Build Wrapper tool on top .
![]() |
Testing wrapper |
Once you select this give a name say config for the file to be saved. When your log says succesfully created the file select the Test wrapper next to Build Wrapper .Now you have your exe file in the folder you selected
NewFolder
-> DeskApp.jar
-> DB
->db_data
->Tulips.ico
->win.exe
->config
->config
There might be easier and efficient ways of doing this but right now I used the Inno setup compiler .I think its simpler for beginners.
Once you have this installed in your system start it. First you will find a welcome window under that choose only Create a new script file using the script wizard and then click OK

The Inno set up Script wizard appears on this.
Click next and fill the details of your application your company profile etc where only name of your application and its version is necessary.
On next page specify where you want your application to be installed (normally it will be in program files) you can also give a folder name for your application (which is recommended) and check allow user to change folder.
Next you have to choose the exe file you created just now using launch4j.
Below that you will see Add folder .Browse and add the main DB folder .Select yes for should subfolders be included?

In application documentation you can include text files for license etc(not mandatory).
Choose your language and click next .
There you can choose a folder where you want your set up file to reside under Custom compiler output folder and the icon file used for exe file(you can have another image).
Finish the wizard.
Click next and fill the details of your application your company profile etc where only name of your application and its version is necessary.
On next page specify where you want your application to be installed (normally it will be in program files) you can also give a folder name for your application (which is recommended) and check allow user to change folder.
Next you have to choose the exe file you created just now using launch4j.
Below that you will see Add folder .Browse and add the main DB folder .Select yes for should subfolders be included?

In application documentation you can include text files for license etc(not mandatory).
Choose your language and click next .

Finish the wizard.
Choose yes when it asks would you like to compile the new script now ? and save the script before compiling .This can be useful later if you have to change the script.
After the compilation is done you can check the setup folder. Double click the file and you can see your installer running.After all installation is done you will see the desktop icon of your application . You can double click and run your application from desktop (For windows 7 right click on icon and run as administrator) In control panel you can also find your application under uninstall programs ,from where you can remove it completely
This may or may not be a professional way of approaching this issue... .just found a small thing and was excited to share with all. Hope this was helpful in some way and you got a slight idea about deployment. Looking forward to your feedback's and comments.
Check out my next post for deploying a desktop application on a system without java installed
Software License for Launch4j
Software License for InnosetUp
Check out my next post for deploying a desktop application on a system without java installed
Software License for Launch4j
Software License for InnosetUp
82 comments:
Thank you Aparna, a long awaited article. Thank you so much. In addition to it, if we can make serial key based installers, then it would be a lot helpful to build a commercial application installer. That's just a suggestion, if you can manage time then that would too help the beginners like us.
Thank you for your valuable feedback.
Once I finish experimenting on serial key based installers will definitely include it as my upcoming post.
Thank you Aparna, that post will be highly awaited.
Hey Aparna,thank you so much.My application working on local machine but not on another machine.It is throwing exception database not found.please help me!
Are you sure that you packed your database file together with the exe?
My db name is MyDB.So I included that MyDB folder,jar file in store folder to new folder.is it right?
You can give any folder name but make sure you keep the folder hierarchy.
That is inside the New Folder make another folder named Db and inside that place your database. Check if its right .. If the system where you are installing doesn't have java then see my next post to package jre along with exe.
Also check if you have changed your system specific path to "jdbc:derby:MYDB" just before building your application.
if I change path to jdbc:derby:MyDB then while testing wrapper it throws exception
database MyDB not found
GMT Thread[AWT-EventQueue-0,6,main] java.io.FileNotFoundException: derby.log (Access is denied) This is what you get right ? just ignore and continue
I m getting following exception java.sql.SQlException:database "MyDB" not found!
I think Im getting this exception coz I changed path from jdbc:derby:c:/...netbeans/7.1/derby/MyDB to jdbc:derby:MyDB
But that will not work in another system. So its your folder hierarchy issue. I just did it once more here and its fine.
Actually after changing path java program also throws that database not found exception.
When you have to run your program from ide you should not change the path because it points to database in jdbc:derby:c:/...netbeans/7.1/derby/MyDB folder in your system and that is correct. What i suggested is once all your checking is done, change the path to jdbc:derby:MyDB and after that, don't run your program but select clean and build. Then package and store the jar. After this make a folder and inside that place your jar from store folder and database as mentioned in the post. Strictly keep the hierarchy.
You mentioned "In this xml code, just before closing paste the code in the below site"
where is this code??
Thanks a lot. This is really helpful .....
I think you are referring to this link http://www.oracle.com/technetwork/articles/javase/index-139904.html
I followed all your steps.But jar file made in store folder can't find javadb connection.What's wrong?
Hey Aparna,I followed your previous post and made my project now if i follow all steps of this post then db connection is not made.
if i do the same with java database type project then it is making connection.But i need to do all things with my previous project.
Can you please give me some solution.
Hey Aparna,I followed your previous post and made my project now if i follow all steps of this post then db connection is not made.
if i do the same with java database type project then it is making connection.But i need to do all things with my previous project.
Can you please give me some solution.
Hey Aparna,I followed your previous post and made my project now if i follow all steps of this post then db connection is not made.
if i do the same with java database type project then it is making connection.But i need to do all things with my previous project.
Can you please give me some solution.
Hi Aparna,
This is very crisp and useful post. At least for my case, I prefer to code in java mainly because I like to see my Apps running in different Operating Systems. Can you suggest me how do I wrap it for Linux flavor operating systems ?
Hey guys,
I got the same problem with you guys:db not found for the exe.
I found you have to put the whole db folder with the exe file together so that it can find it.
Hope this can help.
Great blog!!
Thank you so much for this post.It was really useful to me. I was searching for an easy and efficient way to deploy my Java applications for the last couple of days.
You are really a geek.Keep going,All the best.
I want to Pack my database with my java application.
I have used derby database with client driver.
But I'm Not Able To The Packaging thing along with database can you help? pleaseeeeeeeeeeeeeeeeeeeeeeeee i will be really thank full to you
Nice post. I have bookmarked you to check your new stuff. Thanks for sharing this useful post, Please keep sharing more...
Application Packaging
Sccm Deployment
Application Compatibility Toolkit
Aparna.. You have no idea how much you've helped me. I finished my project on time coz of you. And whatever you do please do not stop this. Helps a ton to people like me.
Thanks again!
I am so glad to be given a chance to read your wonderful article. Im looking forward to read more of your works and posts. You did a good job! Try to visit my site too and enjoy.
triciajoy.com
www.triciajoy.com
Thank you for your post.
I followed your tutorial and got some success, but still some more help is required.
I am working with Netbeans 7.4 IDE and there is no PACKAGE FOR STORAGE on run target. So I created an .exe file with the jar created by IDE and when I run it, it only shows the splash and after that no JFrame is created.
I am also running a Compatibility issue. When I am installing in win XP it install properly with splash only, but when I am installing in win7, it install in a compatible mode.
Can you please provide me a solution to fix it? When I Click the jar file it works fine (splash & log in page both appears).
This blog awesome and i learn a lot about programming from here.The best thing about this blog is that you doing from beginning to experts level.
Love from
@Aparna
Actually the site name and link you provide for snapshot is not working.
by clicking on link I am redirecting to http://www.oracle.com/technetwork/java/index.html link.
Please verify it and update your blog.
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
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
Very Useful Blog I really Like this blog and i will refer this blog...
And i found a some usefull content for Online training check It out .
This is an awesome post.Really very informative and creative contents. These concept is a good way to enhance the knowledge.I like it and help me to development very well.Thank you for this brief explanation and very nice information.Well, got a good knowledge.
Java Training in Chennai
Really informative article. Please Visit:
windows 7 to 10 migration
16-bit application
Windows Packaging
Very Informative post.
I want to run this exe file on another system which already have java environment.Problem i facing it needs relative path of database in connection string(DriverManager.getConnection).Kindly suggest a way to pass relative path of database in connection string.
Learned a lot of new things from your post, Thaks for sharing
Java Online Training
It is very interesting to learn from to easy understood. Thank you for giving information. Weblogic Administration Training
Awe! What An Blog Very Helpful and interesting Really A great center for acquiring knowledge.Very Helpful Post And Explained Very Clearly About All the things.Very Helpful. Coming To Our Self We Provide Restaurant Equipment Parts .Really Thankfull For the blogger providing such a great information.Thank you. Have a Nice Day.
This Blog is very helpful and useful,came to know that i should be strong in my basics and this blog helps me to improve it,Urgent Care Services Provided by Us.Thanks For Posting.I Am refereed by my friend to this blog and i also want to refer my other friends to this blog.
Thank you for sharing beneficial information nice post Bala Guntipalli
The young boys ended up stimulated to read through them and now have unquestionably been having fun with these things.
Hadoop Training in Bangalore
Hadoop Training in Chennai
Thanks For Sharing Such an Useful Information....
Vizag Real Estate
Great thoughts you got there, believe I may possibly try just some of it throughout my daily life.
selenium training in chennai
aws training in chennai
hank you for benefiting from time to focus on this kind of, I feel firmly about it and also really like comprehending far more with this particular subject matter. In case doable, when you get know-how, is it possible to thoughts modernizing your site together with far more details? It’s extremely useful to me
java training in chennai | java training in bangalore
java online training | java training in pune
Inspiring writings and I greatly admired what you have to say , I hope you continue to provide new ideas for us all and greetings success always for you..Keep update more information..
rpa training in Chennai
rpa training in anna nagar | rpa training in marathahalli
rpa training in btm | rpa training in kalyan nagar
rpa training in electronic city | rpa training in chennai
rpa online training | selenium training in training
Inspiring writings and I greatly admired what you have to say , I hope you continue to provide new ideas for us all and greetings success always for you..Keep update more information..
Data Science with Python training in chenni
Data Science training in chennai
Data science training in velachery
Data science training in tambaram
Data Science training in OMR
Data Science training in anna nagar
Data Science training in chennai
Data science training in Bangalore
This is ansuperior writing service point that doesn't always sink in within the context of the classroom. In the first superior writing service paragraph you either hook the reader's interest or lose it. Of course your teacher, who's getting paid to teach you how to write an good essay,
python training in tambaram
python training in annanagar
python training in OMR
I would assume that we use more than the eyes to gauge a person's feelings. Mouth. Body language. Even voice. You could at least have given us a face in this test.
java training in omr | oracle training in chennai
java training in annanagar | java training in chennai
Wonderful bloggers like yourself who would positively reply encouraged me to be more open and engaging in commenting.So know it's helpful.
python online training
python training in OMR
python training institute in chennai
Woah this blog is wonderful i like studying your posts. Keep up the great work! You understand, lots of persons are hunting around for this info, you could help them greatly.
Data Science course in rajaji nagar | Data Science with Python course in chenni
Data Science course in electronic city | Data Science course in USA
Data science course in pune | Data science course in kalyan nagar
Great post! I am actually getting ready to across this information, It’s very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.
Devops Training in pune
I found this informative and interesting blog so i think so its very useful and knowledge able.I would like to thank you for the efforts you have made in writing this article.
angularjs-Training in sholinganallur
angularjs-Training in velachery
angularjs Training in bangalore
angularjs Training in bangalore
angularjs Training in btm
I believe that your blog will surely help the readers who are really in need of this vital piece of information. Waiting for your updates.
IELTS Training Institute in T Nagar
IELTS Classes in KK Nagar
IELTS Classes in Chennai Ashok Nagar
IELTS Coaching near Porur
IELTS Training in Poonamallee
IELTS Coaching Center near me
IELTS in Ramapuram
Good Post, I am a big believer in posting comments on sites to let the blog writers know that they ve added something advantageous to the world wide web.
Best Devops Training in pune
Microsoft azure training in Bangalore
Power bi training in Chennai
I was recommended this web site by means of my cousin.
I am now not certain whether this post is written through him as nobody else recognise such precise about my difficulty. You're amazing! Thank you!
selenium training in Chennai
selenium training in Tambaram
selenium training in Velachery
selenium training in Omr
selenium training in Annanagar
Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic.
python training in chennai
Python Online training in usa
python course institute in chennai
Thanks for splitting your comprehension with us. It’s really useful to me & I hope it helps the people who in need of this vital information.
devops online training
aws online training
data science with python online training
data science online training
rpa online training
Awesome article. It is so detailed and well formatted that i enjoyed reading it as well as get some new information too.
Microsoft Azure online training
Selenium online training
Java online training
uipath online training
Python online training
AngularJS Training in Chennai AngularJS Training in Chennai at BITA Academy. We are Best AngularJS Training Institute in Chennai. Our AngularJS training courses are taught by Experts.
good information.....!
inplant training in chennai
inplant training in chennai
inplant training in chennai for it
brunei darussalam web hosting
costa rica web hosting
costa rica web hosting
hong kong web hosting
jordan web hosting
turkey web hosting
gibraltar web hosting
superb....
inplant training in chennai for it
namibia web hosting
norway web hosting
rwanda web hosting
spain hosting
turkey web hosting
venezuela hosting
vietnam shared web hosting
inplant training in chennai
inplant training in chennai
inplant training in chennai for it.php
chile web hosting
colombia web hosting
croatia web hosting
cyprus web hosting
bahrain web hosting
india web hosting
iran web hosting
nice........
inplant training in chennai
inplant training in chennai
online python internship
online web design
online machine learning internship
online internet of things internship
online cloud computing internship
online Robotics
online penetration testing
super...!
internship in chennai for ece students
internships in chennai for cse students 2019
Inplant training in chennai
internship for eee students
free internship in chennai
eee internship in chennai
internship for ece students in chennai
inplant training in bangalore for cse
inplant training in bangalore
ccna training in chennai
Very Nice...
internship in chennai for ece students with stipend
internship for mechanical engineering students in chennai
inplant training in chennai
free internship in pune for computer engineering students
internship in chennai for mca
iot internships
internships for cse students in
implant training in chennai
internship for aeronautical engineering students in bangalore
inplant training certificate
it is excellent blogs...!!
inplant training for diploma students
mechanical internship in chennai
civil engineering internship in chennai
internship for b.arch students in chennai
internship for ece students in core companies in chennai
internship in chandigarh for ece
industrial training report for computer science engineering on python
internship for automobile engineering students in chennai
big data training in chennai
ethical hacking internship in chennai
nice information....
winter internship for engineering students
internship for mca students
inplant training for eee students
inplant training for eee students/
java training in chennai
internships for eee students in hyderabad
ece internship
internship certificate for mechanical engineering students
internship in nagpur for computer engineering students
kaashiv infotech internship
internship for aeronautical engineering students in india 2019
nice information......
ree internship in bangalore for computer science students
internship for aeronautical engineering
internship for eee students in hyderabad
internship in pune for computer engineering students 2018
kaashiv infotech internship fees
industrial training certificate format for mechanical engineering students
internship report on machine learning with python
internship for biomedical engineering students in chennai
internships in bangalore for cse
internship in coimbatore for ece
very nice blogger thanks for sharing......!!!
poland web hosting
russian federation web hosting
slovakia web hosting
spain web hosting
suriname
syria web hosting
united kingdom
united kingdom shared web hosting
zambia web hosting
FANTASTIC!!!
Robotics training in chennai
Internship for cse students in chennai
Iot internship in chennai
Kaashiv infotech in bangalore
Free internship in chennai for mechanical engineering students
Inplant training
Ece internship in chennai
Internship for cse students in bangalore
Free internship for cse students in chennai
Internship for eee students in chennai
It would have been the happiest moment for you,I mean if we have been waiting for something to happen and when it happens we forgot all hardwork and wait for getting that happened.
AWS training in chennai | AWS training in annanagar | AWS training in omr | AWS training in porur | AWS training in tambaram | AWS training in velachery
Thanks to sharing this nice information, I really appreciate your thinking.......................... oracle training in chennai
If Oracle is your dream job, then we, Infycle, are with you to make your dream into reality. Infycle Technologies offers the best Oracle Training in Chennai, which offers various programs in Oracle such as Oracle PLSQL, Oracle DBA, etc., in the 200% hands-on practical training with specialized trainers in the field. Also, the mock interviews will be arranged for the candidates to face the interviews without any fear, and 100% placement assurance will be given here. To have the words above real, call 7502633633 to Infycle Technologies and grab a free demo to know more.Best Oracle Training in Chennai | Infycle Technologies
Reach to the best Python Training institute in Chennai for skyrocketing your career, Infycle Technologies. It is the best Software Training & Placement institute in and around Chennai, that also gives the best placement training for personality tests, interview preparation, and mock interviews for leveling up the candidate's grades to a professional level.
Grab the extraordinary Oracle Course with PLSQL from Infycle Technologies, the best software training institute in Chennai. Infycle offers the Best Oracle PLSQL Training in Chennai, with various IT demanding courses such as Big Data, Python, DevOps, Selenium, Full-Stack development, etc., in complete hands-on practical training with professional tutors in the field. In addition to that, the mock interviews will be done for the candidates so that they can face the interviews with total confidence. To have all these within your hands, call 7502633633 for having a free demo.
Infycle Technologies, the No.1 software training institute in Chennai offers the Selenium course in Chennai for tech professionals, freshers, and students at the best offers. In addition to the Selenium, other in-demand courses such as Python, Big Data, Oracle, Java, Python, Power BI, Digital Marketing, Cyber Security also will be trained with hands-on practical classes. After the completion of training, the trainees will be sent for placement interviews in the top companies. Call 7504633633 to get more info and a free demo.
I feel really happy to have seen your webpage and look forward to so
many more entertaining times reading here. Thanks once more for all
the details.
dot net training institute in chennai
core java course in chennai
Manual Testing Training institute in Chennai
oracle dba course in chennai
java course in chennai
Very Informative blog thank you for sharing. Keep sharing.
Best software training institute in Chennai. Make your career development the best by learning software courses.
informatica classes in chennai
cloud computing courses in chennai
rpa training in chennai
I wish to show thanks to you just for bailing me out of this particular
trouble.As a result of checking through the net and meeting
techniques that were not productive, I thought my life was done.
software testing courses in chennai
javascript training in Chennai
mysql dba training in chennai
Great Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end. best micronutrients for plants
Post a Comment