jdk,tomcat,mysql,inno setup打包
引用地址:
http://www.cnblogs.com/xionghui/archive/2012/03/22/2411207.html
已经做过验证,按步骤来,一切正常
用inno Setup制作安装包
新建一个文件夹exambody,放apache-tomcat-6.0.33、mysql-5.1.37-win32、java(注:jdk)和图标exambody.ico
1.1. 批处理安装mysql服务:
在mysql-5.1.37-win32\bin 的目录下:
新建一个文件:启动服务.bat
里面写:
cd /d %~dp0 (切换到当前目录)
"%cd%\mysqld.exe" -install exambodyMysql
(安装mysqld服务,并命名为exambodyMysql)
net start exambodyMysql (关闭exambodyMysql服务)
新建一个文件:关闭服务.bat
里面写:
net stop exambodyMysql (关闭exambodyMysql服务)
1.2. 批处理安装tomcat服务:
在apache-tomcat-6.0.33目录下:
新建一个文件:启动服务.bat
cd /d %~dp0 (切换到当前目录)
"%cd%\service.bat" install (安装tomcat服务)
然后在当前目录下找到service.bat:
找到:
rem Guess CATALINA_HOME if not defined
set "CURRENT_DIR=%cd%"
if not "%CATALINA_HOME%" == "" goto gotHome
set "CATALINA_HOME=%cd%"
if exist "%CATALINA_HOME%\bin\tomcat6.exe" goto okHome
rem CD to the upper dir
:gotHome
修改成:
rem Guess CATALINA_HOME if not defined
set "CURRENT_DIR=%cd%"
rem if not "%CATALINA_HOME%" == "" goto gotHome
rem set "CATALINA_HOME=%cd%"
rem if exist "%CATALINA_HOME%\bin\tomcat6.exe" goto okHome
rem CD to the upper dir
cd ..
set "CATALINA_HOME=%cd%"
:gotHome
注:rem是注释掉那四行。
cd..是跳到当前目录的上级目录,即apache-tomcat-6.0.33,
set "CATALINA_HOME=%cd%" 是设置CATALINA_HOME为当前目录
找到:
set "EXECUTABLE=%CATALINA_HOME%\bin\tomcat6.exe"
rem Set default Service name
set SERVICE_NAME=Tomcat6
set PR_DISPLAYNAME=Apache Tomcat 6
修改成:
set "EXECUTABLE=%CATALINA_HOME%\bin\tomcat6.exe"
rem Set default Service name
set SERVICE_NAME=exambodyTomcat
set PR_DISPLAYNAME= exambodyTomcat
注:
第一个:exambodyTomcat 修改服务名
第二个:exambodyTomcat 服务显示名
找到:
:doInstall
rem Install the service
echo Installing the service '%SERVICE_NAME%' ...
echo Using CATALINA_HOME: "%CATALINA_HOME%"
echo Using CATALINA_BASE: "%CATALINA_BASE%"
echo Using JAVA_HOME: "%JAVA_HOME%"
rem Use the environment variables as an example
rem Each command line option is prefixed with PR_
修改成:
:doInstall
cd..
set "JAVA_HOME=%cd%\java\jdk1.6.0_21"
rem Install the service
echo Installing the service '%SERVICE_NAME%' ...
echo Using CATALINA_HOME: "%CATALINA_HOME%"
echo Using CATALINA_BASE: "%CATALINA_BASE%"
echo Using JAVA_HOME: "%JAVA_HOME%"
rem Use the environment