自Javaweb系统打包成exe安装文件文档格式.docx
《自Javaweb系统打包成exe安装文件文档格式.docx》由会员分享,可在线阅读,更多相关《自Javaweb系统打包成exe安装文件文档格式.docx(31页珍藏版)》请在冰豆网上搜索。
5、在本地启动服务,导入数据库及数据
(如果本机已经安装了mysql,记得关掉当前的服务)
运行cmd.exe进入DOS窗口,进到D:
\mysql5\bin目录
注册服务:
mysqld--installmysql5--defaults-file=d:
\mysql5\my.ini
可能会出现Install/RemoveoftheServiceDenied!
错误,这时要关闭DOS窗口,以管理员的身份运行cmd.exe程序。
启动服务:
netstartmysql5
使用命令或mysql第三方客户端,创建数据库并导入数据
停止服务:
netstopmysql5
参考图片—
6、停止服务后,将mysql5整个目录剪切到目录webExe下
五、打包脚本准备
1、当前目录情况如下图:
2、脚本文件AddPath.nsh(复制到编辑器HMNISEdit中保存)
!
ifndef_AddToPath_nsh
define_AddToPath_nsh
verbose3
include"
WinMessages.NSH"
verbose4
ifndefWriteEnvStr_RegKey
!
ifdefALL_USERS
defineWriteEnvStr_RegKey\
'
HKLM"
SYSTEM\CurrentControlSet\Control\SessionManager\Environment"
'
else
defineWriteEnvStr_RegKey'
HKCU"
Environment"
endif
;
AddToPath-Addsthegivendirtothesearchpath.
Input-headofthestack
Note-Win9xsystemsrequiresreboot
FunctionAddToPath
Exch$0
Push$1
Push$2
Push$3
#don'
taddifthepathdoesn'
texist
If"
$0\*.*"
"
"
AddToPath_done
ReadEnvStr$1PATH
Push"
$1;
$0;
CallStrStr
Pop$2
StrCmp$2"
$0\;
GetFullPathName/SHORT$3$0
$3;
$3\;
CallIsNT
Pop$1
StrCmp$11AddToPath_NT
;
NotonNT
StrCpy$1$WINDIR2
$1"
$1\autoexec.bat"
a
$1-1END
$1$2
IntCmp$2260+2+2#DOSEOF
$1-1END#writeoverEOF
$\r$\nSETPATH=%PATH%;
$3$\r$\n"
$1
SetRebootFlagtrue
GotoAddToPath_done
AddToPath_NT:
ReadRegStr$1${WriteEnvStr_RegKey}"
PATH"
StrCmp$1"
AddToPath_NTdoIt
CallTrim
StrCpy$0"
$0"
AddToPath_NTdoIt:
WriteRegExpandStr${WriteEnvStr_RegKey}"
$0
SendMessage${HWND_BROADCAST}${WM_WININICHANGE}0"
STR:
/TIMEOUT=5000
AddToPath_done:
Pop$3
Pop$0
FunctionEnd
RemoveFromPath-Removeagivendirfromthepath
Input:
headofthestack
Functionun.RemoveFromPath
Push$4
Push$5
Push$6
IntFmt$6"
%c"
26#DOSEOF
Callun.IsNT
StrCmp$11unRemoveFromPath_NT
r
GetTemp$4
$2$4w
GetFullPathName/SHORT$0$0
SETPATH=%PATH%;
GotounRemoveFromPath_dosLoop
unRemoveFromPath_dosLoop:
$1$3
StrCpy$5$31-1#readlastchar
StrCmp$5$60+2#ifDOSEOF
StrCpy$3$3-1#removeDOSEOFsowecancompare
StrCmp$3"
$0$\r$\n"
unRemoveFromPath_dosLoopRemoveLine
$0$\n"
unRemoveFromPath_dosLoopEnd
$2$3
unRemoveFromPath_dosLoopRemoveLine:
unRemoveFromPath_dosLoopEnd:
$2
Delete"
CopyFiles/SILENT$4"
Delete$4
GotounRemoveFromPath_done
unRemoveFromPath_NT:
StrCpy$5$11-1#copylastchar
StrCmp$5"
+2#iflastchar!
=;
StrCpy$1"
#append;
Callun.StrStr;
Find`$0;
`in$1
Pop$2;
posofourdir
unRemoveFromPath_done
else,itisinpath
#$0-pathtoadd
#$1-pathvar
StrLen$3"
StrLen$4$2
StrCpy$5$1-$4#$5isnowthepartbeforethepathtoremove
StrCpy$6$2"
$3#$6isnowthepartafterthepathtoremove
StrCpy$3$5$6
StrCpy$5$31-1#copylastchar
0+2#iflastchar==;
StrCpy$3$3-1#removelastchar
$3
unRemoveFromPath_done:
Pop$6
Pop$5
Pop$4
AddToEnvVar-Addsthegivenvaluetothegivenenvironmentvar
Input-headofthestack$0environementvariable$1=valuetoadd
FunctionAddToEnvVar
Exch$1;
$1hasenvironmentvariablevalue
Exch
Exch$0;
$0hasenvironmentvariablename
DetailPrint"
Adding$1to$0"
ReadEnvStr$2$0
$2;
AddToEnvVar_done
$1\;
StrCmp$21AddToEnvVar_NT
StrCpy$2$WINDIR2
$2"
$2\autoexec.bat"
$2-1END
IntCmp$3260+2+2#DOSEOF
$2-1END#writeoverEOF
$\r$\nSET$0=%$0%;
$4$\r$\n"
GotoAddToEnvVar_done
AddToEnvVar_NT:
ReadRegStr$2${WriteEnvStr_RegKey}$0
StrCpy$3$21-1#copylastchar
StrCpy$2$2-1#removelastchar
AddToEnvVar_NTdoIt
$1"
AddToEnvVar_NTdoIt:
WriteRegExpandStr${WriteEnvStr_RegKey}$0$1
AddToEnvVar_done:
RemoveFromEnvVar-Removeagivenvaluefromaenvironmentvar
Functionun.RemoveFromEnvVar
Removing$1from$0"
Push$7
IntFmt$7"
StrCmp$21unRemoveFromEnvVar_NT
GetTemp$5
$3$5w
GetFullPathName/SHORT$1$1
SET$0=%$0%;
GotounRemoveFromEnvVar_dosLoop
unRemoveFromEnvVar_dosLoop:
$2$4
StrCpy$6$41-1#readlastchar
StrCmp$6$70+2#ifDOSEOF
StrCpy$4$4-1#removeDOSEOFsowecancompare
StrCmp$4"
$1$\r$\n"
unRemoveFromEnvVar_dosLoopRemoveLine
$1$\n"
unRemoveFromEnvVar_dosLoopEnd
$3$4
unRemoveFromEnvVar_dosLoopRemoveLine:
unRemoveFromEnvVar_dosLoopEnd:
CopyFiles/SILENT$5"
Delete$5
GotounRemoveFromEnvVar_done
unRemoveFromEnvVar_NT:
StrCpy$6$21-1#copylastchar
StrCmp$6"
StrCpy$2"
Find`$1;
`in$2
Pop$3;
unRemoveFromEnvVar_done
#$1-pathtoadd
#$2-pathvar
StrLen$4"
StrLen$5$3
StrCpy$6$2-$5#$6isnowthepartbeforethepathtoremove
StrCpy$7$3"
$4#$7isnowthepartafterthepathtoremove
StrCpy$4$6$7
StrCpy$6$41-1#copylastchar
StrCpy$4$4-1#removelastchar
WriteRegExpandStr${WriteEnvStr_RegKey}$0$4
deleteregvalueifnull
0+2#ifnulldeletereg
DeleteRegValue${WriteEnvStr_RegKey}$0
unRemoveFromEnvVar_done:
Pop$7
ifndefIsNT_KiCHiK
defineIsNT_KiCHiK
###########################################
#UtilityFunctions#
IsNT
noinput
output,topofthestack=1ifNTor0ifnot
Usage:
Pop$R0
($R0atthispointis1or0)
macroIsNTun
Function${un}IsNT
Push$0
ReadRegStr$0HKLM"
SOFTWARE\Microsoft\WindowsNT\CurrentVersion"
CurrentVersion
StrCmp$0"
0IsNT_yes
wearenotNT.
Push0
Return
IsNT_yes:
NT!
Push1
macroend
insertmacroIsNT"
un."
endif;
IsNT_KiCHiK
StrStr
input,topofstack=stringtosearchfor
topofstack-1=stringtosearchin
output,topofstack(replaceswiththeportionofthestringremaining)
modifiesnoothervariables.
thisisalongassstring"
ass"
($R0atthispointis"
assstring"
)
macroStrStrun
Function${un}StrStr
Exch$R1;
st=haystack,old$R1,$R1=needle
Exch;
st=old$R1,haystack
Exch$R2;
st=old$R1,old$R2,$R2=haystack
Push$R3
Push$R4
Push$R5
StrLen$R3$R1
StrCpy$R40
$R1=needle
$R2