I have this Java application which uses a MySql Database which I want to distribute. My concern is that, to distribute this application I'll need to make the assumption that the target system has both JRE and MySql Server installed.
Is there any way I could bundle my application with the JRE and the MySql server so that if they aren't already present on the system, my app can install them and then run the application?
You CAN bundle a JRE with a Java application, provided that you follow certain conditions. (If I recall correctly, this is covered by the standard Sun/Oracle license that you agree to when you download the JRE. I think the phrase is a "binary distribution" or "binary redistribution".)
UPDATE
I just checked, and my memory is correct. See Supplemental License Terms section of "Oracle Binary Code License Agreement for the Java SE Platform Products and JavaFX". (Paragraph C is the most directly applicable to your scenario.) And as I said above, conditions apply.
END UPDATE
I don't believe that you are permitted to bundle the free version of MySQL.
Personally, I would recommend AGAINST doing this for Java, because:
- It inflates the size of your distributable.
- It fills the user's disc with extra copies of the JRE.
- It presents a problem if it becomes necessary to patch the bundled JRE that the user has (unwittingly) installed.
- You are making it difficult for the (sophisticated) user to choose which version of Java to use.
No you should not bundle them and deliver them as part of your installation because of licensing.
This applies to both Oracle JRE and MySQL.
Update after @Stephen C comment.
It seems that it is possible to redistribute the JRE provided certain circumstances.It is illadviced though for the reasons that are explained in Stephen C answer. I have seen these issues arise in practice.
End Update
I am not sure what is the "safest" path (safest related to licensing issues).
Perhaps an installer that downloads them on the spot as part of the required components is ok.Friends here can correct me if I am wrong on this