Recently I made an application in using Swing, HSQL Embedded that manages some database. I used HSQL as the backend to connect to the database. What I want to do is create a setup/installer program so that the application can be installed and used on any pc. My problem is I dont know how to integrate the database along?
You can use exe4j to generate .exe.
And wizard4j to create installer for your application.
Problem is that creation of exe is quite isolated case. In case of Windows, you will create msi package, in case of OSX, you will create dmg, in case of Linux, you will create rpm or tar.gz etc. Yes you could use exe4j, install4j etc. But I strongly recommend to put your jar in one specific folder, zip it and distribute in that format.
Now, when it comes to your database "integration", have a look at this question and this documentation. Reason for distributing Java application this way and not with installer come from bad experiences I encountered when writing data into flat file databases after applications get installed via install4j or exe4j.
Related
I created a java application that is a front end for a MySQL Database using NetBeans and JDBC.
Now after creating the jar file it runs smoothly on my computer (Since I have the MySQL installed) but, if I run the jar on a different computer it won't work since it does not have the DB the application is using and not even MySQL installed.
So the question is, is it possible to add the database to the executable jar so it will run on any computer without the need for any installation of any software (Except for JRE of course) ?
If yes, how do I go about doing so?
Thanks everyone for the help in advance.
Use derby database. It already included in JDK's db folder when you installed the Java on your computer.
If you purely want to use the database without using the MySql then simply using the collections to create database, then you doesn't need any other database client as like MySql. But you need knowledge of Hibernate, Spring etc.
I am developing an application with Swing and MySql. I want to distribute it to the clients, where they could run the application on their end/PC without worrying about installing MySql and other technical stuff. So, I thought of bundling JRE and MySql but then I came across Correctly distributing a Java application with database which says it is not preferable to do so. As it would increase the application size on disk, which obviously is an issue.
So, my questions are
How do I achieve the same and what tool and resources should I use.
Is SQLite a good option?
Any help is appreciated.
In my opinion SQLite and Apache Derby (http://db.apache.org/derby/) are both good for such a plan. Some years ago i did such stuff with derby and it's still running. At that time i just packaged the folder that contained the jre, the program, libs (jar's) and the data folder of derby.
As i remember: sqlite was very easy to use whereas derby is more overhead to learn.
Please try using HsqlDb visit the link
[http://hsqldb.org/ ]
Easy to use and you can embed it into your jar.
I have been working on a freeware application named "Cyberoam Iview" that has two modules, one written in C and the other in JAVA. Just for you know, this is an online application that requires JDK,PostgreSql database,Apache Server to setup on any host system environment.
I tweaked some changes to the available source-code according to my requirement. After the changes, I want to deploy this application as a one single packaged file, like in ".exe" format. All it's pre-requisites are required to be bundled in a single ".exe" format so that when I run that ".exe" file on my system, it installs and setup every application that it requires to run like installing Postgresql, setting up Apache server environment, JDK.
I read many posts and discussions, and thus tried my hands with CYGWIN tool to deploy the application, but failed to do so.
Suggestions are most welcome. Thanks in advance.
You can take a look at JSMooth. I use this for this purpose. You can create a standalone executeable and it even provides a downloader if no Java is installed.
I have some good experiences with IzPack installer and I can highly recommend it. You can check out my short and simple tutorial at Softwarepassion website - I guess a bit outdated tho.
You should be able to pack your jars and all external files as a single file
I have created a Java Swing application with database in NetBeans IDE. I have a database created directly in NetBeans. How do I arrange that this application will be installed to run outside NetBeans IDE? For example in Windows. When I have applications without database, it is easy; but the database I do not know.
you need to install a database such as:
mysql, microsoft sql, sqlite, etc.
You can also get portable versions of these that only require an unzip and run (e.g. mysql in xampp).
You will need to create a script (either in your program or do it by hand) to create the necessary schema, and tables that are needed.
Your application must have the same credentials for both your database but also within your requests from java.
If your doing the installation by hand you usually do all the above by hand.
The database need not be on the same computer but can be on the same network or also on the internet - but it will have to be somewhere unless your using something portable like sqllite.
If your creating an automated install script you should define that in your question.
I am developing a standalone application for a client using Java Swing and jdbc with MySQL. I am using MySQL as the database.I want to know that how the client can install MySQL, is there a way by which the client can install MySQL in his machine,or can i distribute the MySQL setup.The client just needs the software running and do not want to go to any installation process.
What is the way around with that??
Use Java Web Start to launch the app.
The MySQL installer can be invoked from an installer-desc element in the launch file. Here is my demo. of the JNLP API ExtensionInstallerService.
You're likely to find H2, HSQLDB, Derby, or SQLite to be more suitable for your deployment. They're intended to be embedded in other applications.
This might not be the simplest solution, but it is a good idea to have an installer for your application, which would take care of MySQL installation. IzPack is a very reasonable installation tool, which can execute external applications (e.g. MySQL installer) as part of the installation process. This discussion might be of some interest.
However, as mentioned in other replies, the use of an embedded RDBMS such as H2, SQLite etc., is a better choice than MySQL for a standalone application.
Few portable database alternatives: Derby, SQLite.