Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finished Java project, now creating jar or .exe file (with Database)

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 :)

like image 904
Tha.Poox Avatar asked Sep 02 '13 21:09

Tha.Poox


3 Answers

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

like image 76
micha Avatar answered Oct 26 '22 23:10

micha


You can create an executable jar by exporting your project through eclipse. You can do this by following these steps:

  • Right click on the Project
  • Export as Jar file
like image 40
raghav vishnoi Avatar answered Oct 27 '22 01:10

raghav vishnoi


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.

like image 41
Tyler Avatar answered Oct 27 '22 00:10

Tyler