Java 应用程序和 MySQL 安装在单个包中
如何将 Java 应用程序和 MySQL 安装文件打包到一个 exe 文件中?我可以在后台自动安装 MySQL 文件(或者无需用户输入任何内容)吗?这只是为了简化安装过程。
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 user)? This is just to simplify the installation procedure.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Java 是跨平台的,而 MySQL 不是,因此您必须使用不同的 MySQL 二进制文件为多个平台创建各种安装程序。如果您想包含非 Windows 系统的 MySQL 源代码,那就是另一回事了……所以我假设您只需要 Windows 的安装。
首先,获得一个您觉得舒服的安装软件。 维基百科上有一个很好的免费和非免费安装程序列表。
第二件事,你可以进行静默 MySQL 安装。 此处解释了它是如何完成的。
但请注意,在没有用户许可的情况下进行静默 MySQL 安装对我来说听起来不太好,因为 MySQL 并不是完全的轻量级软件,如果用户已经在某处安装了 MySQL,则可能会搞砸一些事情。
因此,通过执行此操作,您必须格外小心地检查端口 3306 是否已启动并正在运行(默认 MySQL 端口),并进行其他健全性检查以查看是否有另一个实例潜伏在后台的可能性。
如果您至少通知您的用户将安装 MySQL,那就更好了。考虑这些细节,因为它们可能会破坏您的某些用户的交易。
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.
使用 Java Web Start 启动应用程序。
JWS 提供了
ExtensionInstallerService
可用于安装 MySQL。这是一个小型 演示。 ExtensionInstallerService 的。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.