Reputation: 53
So, i've just finished a small java application, with database and stuff... I used Netbeans and Mysql, now i want to export my project so i can use it anywhere i want; any computer, even with no Mysql or Java installed! So, i've tried some programs like Launch4j or something... but the main problem is, even if i make the .exe file, what's gonna happen with the database? it's located in my PC, so if somebody try to use my application, he can't access to the database, so the application won't work...
In other words...What is the solution that i can use to like "Combine" the database with the application, if it is possible? or create the .exe file with the database... I hope that my problem is clear, and thank you for your answers :)
Upvotes: 5
Views: 26924
Reputation: 74
You can create an executable jar by exporting your project through eclipse. You can do this by following these steps:
Upvotes: 2
Reputation: 49602
You can look at MySQL Connector/MXJ to embed your mysql database in your application.
But be aware that this package is no longer under active development:
Due to very low demand, MySQL has stopped development and support for Connector/MXJ. Source and binaries for previously released versions will continue to be available from archives.
An alternative solutation would be using another database like SQLite, H2 or HSQLDB
Upvotes: 3
Reputation: 369
if you really want to give your users a good experience, I would suggest you implement a embedded database in your application instead.
Look at: http://www.h2database.com/
It's free and open source and I use it heavily myself. It supports embedded (where it creates flat database files on the computer), in-memory, and server-mode, where you have the possibility of letting multiple-applications share the same database.
It's just a jar file you include in your application, and then the users wont have to install neither MySQL, have access to MySQL on a network drive or need other database software installed. (depending on your requirements, it might also be a good idea to look into Hibernate, to have some more abstraction between the different RDBMS).
Upvotes: 2
Reputation: 698
When you were programming in netbeans did you include the database within netbeans? Here is a guide on how to do this.
https://netbeans.org/kb/docs/ide/mysql.html
Also here is a second guide on how to Packaging and Distributing Java Desktop Applications
https://netbeans.org/kb/docs/java/javase-deploy.html
I hope these help.
If not just go over your step you took to build the app.
Upvotes: 1
Reputation: 5165
In order to get a database built-in to the application, consider HSQLDB, which is an in-memory database.
It can run entirely in the JVM without any external resources.
Upvotes: 0