jdk,tomcat,mysql,inno setup打包
引用地址:
http://www.cnblogs.com/xionghui/archive/2012/03/22/2411207.html
已经做过验证,按步骤来,一切正常
用innoSetup制作安装包
新建一个文件夹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"-installexambodyMysql
(安装mysqld服务,并命名为exambodyMysql)
netstartexambodyMysql(关闭exambodyMysql服务)
新建一个文件:关闭服务.bat
里面写:
netstopexambodyMysql(关闭exambodyMysql服务)
1.2.批处理安装tomcat服务:
在apache-tomcat-6.0.33目录下:
新建一个文件:启动服务.bat
cd/d%~dp0(切换到当前目录)
"%cd%\service.bat"install(安装tomcat服务)
然后在当前目录下找到service.bat:
找到:
remGuessCATALINA_HOMEifnotdefined
set"CURRENT_DIR=%cd%"
ifnot"%CATALINA_HOME%"==""gotogotHome
set"CATALINA_HOME=%cd%"
ifexist"%CATALINA_HOME%\bin\tomcat6.exe"gotookHome
remCDtotheupperdir
:gotHome
修改成:
remGuessCATALINA_HOMEifnotdefined
set"CURRENT_DIR=%cd%"
remifnot"%CATALINA_HOME%"==""gotogotHome
remset"CATALINA_HOME=%cd%"
remifexist"%CATALINA_HOME%\bin\tomcat6.exe"gotookHome
remCDtotheupperdir
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"
remSetdefaultServicename
setSERVICE_NAME=Tomcat6
setPR_DISPLAYNAME=ApacheTomcat6
修改成:
set"EXECUTABLE=%CATALINA_HOME%\bin\tomcat6.exe"
remSetdefaultServicename
setSERVICE_NAME=exambodyTomcat
setPR_DISPLAYNAME=exambodyTomcat
注:
第一个:exambodyTomcat修改服务名
第二个:exambodyTomcat服务显示名
找到:
:doInstall
remInstalltheservice
echoInstallingtheservice'%SERVICE_NAME%'...
echoUsingCATALINA_HOME:"%CATALINA_HOME%"
echoUsingCATALINA_BASE:"%CATALINA_BASE%"
echoUsingJAVA_HOME:"%JAVA_HOME%"
remUsetheenvironmentvariablesasanexample
remEachcommandlineoptionisprefixedwithPR_
修改成:
:doInstall
cd..
set"JAVA_HOME=%cd%\java\jdk1.6.0_21"
remInstalltheservice
echoInstallingtheservice'%SERVICE_NAME%'...
echoUsingCATALINA_HOME:"%CATALINA_HOME%"
echoUsingCATALINA_BASE:"%CATALINA_BASE%"
echoUsingJAVA_HOME:"%JAVA_HOME%"
remUsetheenvironmentvariablesasanexample
remEachcommandlineoptionisprefixedwithPR_
注:cd..是跳到当前目录的上级目录,即exambody
set"JAVA_HOME=%cd%\java\jdk1.6.0_21"
是设置JAVA_HOME为exambody\java\jdk1.6.0_21
找到:
echoTheservice'%SERVICE_NAME%'hasbeeninstalled.
:end
cd"%CURRENT_DIR%"
修改成:
echoTheservice'%SERVICE_NAME%'hasbeeninstalled.
scconfigexambodyTomcatstart=auto
scstartexambodyTomcat
:end
cd"%CURRENT_DIR%"
注:scconfigexambodyTomcatstart=auto
设置exambodyTomcat为自启动
scstartexambodyTomcat启动exambodyTomcat服务
新建一个文件:关闭服务.bat
netstopexambodyTomcat(关闭exambodyTomcat服务)
1.3.新建一个编译文件exambody:代码如下:
#defineMyAppName"查体管理系统"
#defineMyAppVersion"1.0"
[Setup]
AppName={#MyAppName}(安装程序名)
AppVersion={#MyAppVersion}(设置版本)
;AppVerName={#MyAppName}{#MyAppVersion}
DefaultDirName=D:\exambody(安装默认路径)
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
OutputDir=output(输出路径)
OutputBaseFilename=setup(安装程序名)
SetupIconFile=exambody\exambody.ico(设置图标)
Compression=lzma
SolidCompression=yes
[Languages](设置语言)
Name:"chinesesimp";MessagesFile:"compiler:Default.isl"
[Files](复制文件)
Source:"exambody\*";DestDir:"{app}";Flags:ignoreversionrecursesubdirscreateallsubdirs
[Icons]
Name:"{group}\{cm:UninstallProgram,{#MyAppName}}";Filename:"{uninstallexe}"(卸载文件,并在开始菜单生成快捷键)
Name:"{commondesktop}\查体";Filename:http://localhost:8080(桌面创建主页的快捷方式)
[Run](装完后自动运行的文件)
Filename:"{app}\mysql-5.1.37-win32\bin\启动服务.bat";Flags:nowaitrunhidden;(启动mysql服务)
Filename:"{app}\apache-tomcat-6.0.33\bin\启动服务.bat";Flags:nowaitrunhidden;(启动tomcat服务)