標籤:des blog http io ar os sp java strong
原文:用inno Setup製作web項目安裝包
用inno Setup製作安裝包
建立一個檔案夾exambody,放apache-tomcat-6.0.33、mysql-5.1.37-win32、java(註:jdk)和表徵圖exambody.ico
- 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服務)
- 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 variables as an example
rem Each command line option is prefixed with PR_
註:cd..是跳到目前的目錄的上級目錄,即exambody
set "JAVA_HOME=%cd%\java\jdk1.6.0_21"
是設定JAVA_HOME為exambody\java\jdk1.6.0_21
找到:
echo The service ‘%SERVICE_NAME%‘ has been installed.
:end
cd "%CURRENT_DIR%"
修改成:
echo The service ‘%SERVICE_NAME%‘ has been installed.
sc config exambodyTomcat start= auto
sc start exambodyTomcat
:end
cd "%CURRENT_DIR%"
註:sc config exambodyTomcat start= auto
設定exambodyTomcat為自啟動
sc start exambodyTomcat 啟動 exambodyTomcat服務
建立一個檔案:關閉服務.bat
net stop exambodyTomcat (關閉exambodyTomcat服務)
- 3. 建立一個編譯檔案exambody:
代碼如下:
#define MyAppName "查體管理系統"
#define MyAppVersion "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: ignoreversion recursesubdirs createallsubdirs
[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: nowait runhidden;(啟動mysql服務)
Filename: "{app}\apache-tomcat-6.0.33\bin\啟動服務.bat"; Flags: nowait runhidden;(啟動tomcat服務)
用inno Setup製作web項目安裝包