How can I pack a Java application and MySQL installation files in a single exe file? Can I install the MySQL files automatically in background (or without any inputs from u
Use Java Web Start to launch the application.
JWS offers an ExtensionInstallerService that can be used for installing MySQL. Here is a small demo. of the ExtensionInstallerService.
Java is cross platform, MySQL isn't, so you'd have to create various installers for multiple platforms with different MySQL binaries. If you want to include MySQL source code for non Windows systems, then that's another story... so I assume you want just an installation for Windows.
First of all, get an installation software that you'll feel comfortable with. There is a nice list of free and non free installers on Wikipedia.
Second thing, you can do a silent MySQL installation. How it's done is explained here.
But note that doing a silent MySQL installation without user's permission doesn't sound too good to me, since MySQL isn't exactly lightweight software and you might mess up something if a user already has MySQL somewhere installed.
So, by doing this, you have to be extra careful to check if port 3306 is already up and running (default MySQL port), and other sanity checks to see if there's a possibility of another instance lurking in the background.
It would be better if you at least informed your user that MySQL will be installed. Think about these details, because they might be dealbreakers so some of your users.