JDK+Tomcat+MySQL+war项目 打包.exe文件安装教程(真是令人头大!)

这篇博客详细介绍了如何在Windows上将JDK、Tomcat、MySQL和war项目打包成.exe安装程序。首先,准备所需软件的免安装版本,然后配置my.ini和批处理脚本,最后使用Inno Setup工具创建.exe文件。教程中包含了各个步骤的参考资料链接和关键文件内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

因为我是总结别人的然后结和我自己实际写的这个,所以我把借鉴的放前面。以此感谢这些人的辛勤付出。谢谢你们。

(这是盘符固定的,安装程序,如果想将程序放在任意盘符下,那等更新吧!弄不明白的话参照第一个链接,不懂的话参照第二个链接。有什么问题,可以tomcat日志查看,或者想想你哪做错了~)
参照连接(主要的):https://blog.csdn.net/qq_33240866/article/details/80066541
参考连接(参数配置信息):https://blog.csdn.net/dj0721/article/details/72462688/
参考连接(MySQL5.7.24安装,打包用的MySQL配置):https://blog.csdn.net/qq_38455201/article/details/83419450
参考连接(MYSQL8.0.17<我要给客户打包,这个安装方法会将密码直接展示,没办法提取,所以用着麻烦,如果你自己配置mysql8.0.17的话可以用>):https://blog.csdn.net/wutong14220/article/details/99108518
参考连接(MySQL8.0.17打包用的mysql配置):https://www.jb51.net/article/167678.htm
(有些连接你可能觉得用不上,但是对于我来说真的很有用。)

准备东西

1.下载免安装的mysql(5.5.40)、tomcat(8.5.43)、jdk(jdk1.8.0_65,都是64位的);
2.下载Inno Setup 打包工具(我用的是:Inno Setup 6版);
3.我在C盘建了个文件夹,命名为test ;
4.把下载好的mysql-5.5.40、tomcat8.5.43一起复制到“C:\test”下;
5.如果你要弄个图标的话,再弄个.ico 一起放到“C:\test”下:
现在应该是这个样子。

大概步骤

打包准备,用到的文件

1.将IDEA中的项目,打包成 .war 文件。解压该 .war 文件,将数据库的配置文件放到指定位置:
src里面是连接数据库的文件
我的src文件 百度网盘: 链接:https://pan.baidu.com/s/13tYUfATfJSBPdeU0W2Bt5w
提取码:in8n
把src文件编辑好之后,将文件重新打包成 .war 文件。
<我的项目从IDEA里面打包出来是没有数据库连接配置的,如果你自己的有,忽略这一步。>
将重新打包的war文件放到“C:\test\apache-tomcat-8.5.43\webapps”下;(我的项目打包之后叫web1_war.war)
在这里插入图片描述

2.将JDK复制粘贴进来:
JDK我的版本是1.8.0.65,安装.exe之后直接将安装后生成的文件夹复制之后放在:“C:\test\apache-tomcat-8.5.43\bin\Java ”下
在这里插入图片描述
3.将数据,也就是.sql文件,放在“C:\test\mysql-5.5.40-winx64\data”下;
将数据库中数据导出,并加上创建数据库的SQL语句。放进去

打包准备,用到的脚本

MYSQL

1.官网上下载的mysql是没有my.ini文件的,所以我们要自己写。
附上我自己写的(只需要把没有“#”号的复制进去就行)
<-- my.ini 文件内容 -->

# MySQL Server Instance Configuration File
# ----------------------------------------------------------------------
# Generated by the MySQL Server Instance Configuration Wizard
#
#
# Installation Instructions
# ----------------------------------------------------------------------
#
# On Linux you can copy this file to /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options
# (@localstatedir@ for this installation) or to
# ~/.my.cnf to set user-specific options.
#
# On Windows you should keep this file in the installation directory 
# of your server (e.g. C:\Program Files\MySQL\MySQL Server X.Y). To
# make sure the server reads the config file use the startup option 
# "--defaults-file". 
#
# To run run the server from the command line, execute this in a 
# command line shell, e.g.
# mysqld --defaults-file="D:\test\mysql-5.5.40-winx64\my.ini"
#
# To install the server as a Windows service manually, execute this in a 
# command line shell, e.g.
# mysqld --install MySQLXY --defaults-file="D:\test\mysql-5.5.40-winx64\my.ini"
#
# And then execute this in a command line shell to start the server, e.g.
# net start MySQLXY
#
#
# Guildlines for editing this file
# ----------------------------------------------------------------------
#
# In this file, you can use all long options that the program supports.
# If you want to know the options a program supports, start the program
# with the "--help" option.
#
# More detailed information about the individual options can also be
# found in the manual.
#
#
# CLIENT SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by MySQL client applications.
# Note that only client applications shipped by MySQL are guaranteed
# to read this section. If you want your own MySQL client program to
# honor these values, you need to specify it as an option during the
# MySQL client library initialization.
#
[client]


port=3306


[mysql]


default-character-set=utf8




# SERVER SECTION
# -----------------------------------------------------
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值