javaweb系统打包成exe安装文件

上传人:xiao****1972 文档编号:84822182 上传时间:2019-03-05 格式:DOCX 页数:47 大小:177.15KB
返回 下载 相关 举报
javaweb系统打包成exe安装文件_第1页
第1页 / 共47页
javaweb系统打包成exe安装文件_第2页
第2页 / 共47页
javaweb系统打包成exe安装文件_第3页
第3页 / 共47页
javaweb系统打包成exe安装文件_第4页
第4页 / 共47页
javaweb系统打包成exe安装文件_第5页
第5页 / 共47页
点击查看更多>>
资源描述

《javaweb系统打包成exe安装文件》由会员分享,可在线阅读,更多相关《javaweb系统打包成exe安装文件(47页珍藏版)》请在金锄头文库上搜索。

1、Java web系统打包成exe安装文件一、 工具准备1、 NSIS打包工具: http:/下载并安装;2、 NSIS安装脚本的编辑器HM NIS Editor:http:/下载并安装二、 运行环境准备JDK1、新建打包用的文件夹(本人是在D盘根目录下创建的webExe,即D:webExe);2、JDK本人用的是jdk-6u18,将安装好的JDK目录直接拷贝到目录webExe下就行(绿色版本的也可以)。三、 应用程序准备Tomcat及web应用系统1、 免安装版本的tomcat,本人用的是apache-tomcat-6.0.35,将其放到目录webExe下,并将Web应用系统发布进webapp

2、s中。四、 数据库准备mysql及数据1、 下载一个免安装版本的mysql(本人操作系统是WIN 7 32位,下载的是mysql-noinstall-v5.1.55.zip),解压缩到D盘;2、 将主目录名mysql-5.1.55-win32修改为简单的mysql5(不修改也行,建议修改简单);3、 找到文件my-small.ini改名为my.ini(也可以是将my-huge.ini、my-large.ini、my-medium.ini中任意一个改名为my.ini);4、 将my.ini打开进行配置:# The following options will be passed to all M

3、ySQL clientsclient#password= your_passwordport= 3306socket= MySQLdefault-character-set = utf8-客户端编码# Here follows entries for some specific programs# The MySQL servermysqldport= 3306socket= MySQLdefault-character-set = utf8-服务器端basedir=D:/mysql5 -路径datadir=D:/mysql5/data-数据库路径default-storage-engine

4、= MyISAM -默认数据库引擎为MyISAM5、 在本地启动服务,导入数据库及数据(如果本机已经安装了mysql,记得关掉当前的服务)运行cmd.exe进入DOS窗口,进到D:mysql5bin目录注册服务: mysqld -install mysql5 -defaults-file=d:mysql5my.ini可能会出现Install/Remove of the Service Denied! 错误,这时要关闭DOS窗口,以管理员的身份运行cmd.exe程序。启动服务:net start mysql5使用命令或mysql第三方客户端,创建数据库并导入数据停止服务:net stop mys

5、ql5参考图片6、 停止服务后,将mysql5整个目录剪切到目录webExe下五、 打包脚本准备1、 当前目录情况如下图:2、 脚本文件AddPath.nsh(复制到编辑器HM NIS Edit中保存)!ifndef _AddToPath_nsh!define _AddToPath_nsh !verbose 3!include WinMessages.NSH!verbose 4 !ifndef WriteEnvStr_RegKey !ifdef ALL_USERS !define WriteEnvStr_RegKey HKLM SYSTEMCurrentControlSetControlSes

6、sion ManagerEnvironment !else !define WriteEnvStr_RegKey HKCU Environment !endif!endif ; AddToPath - Adds the given dir to the search path.; Input - head of the stack; Note - Win9x systems requires reboot Function AddToPath Exch $0 Push $1 Push $2 Push $3 # dont add if the path doesnt exist IfFileEx

7、ists $0*.* AddToPath_done ReadEnvStr $1 PATH Push $1; Push $0; Call StrStr Pop $2 StrCmp $2 AddToPath_done Push $1; Push $0; Call StrStr Pop $2 StrCmp $2 AddToPath_done GetFullPathName /SHORT $3 $0 Push $1; Push $3; Call StrStr Pop $2 StrCmp $2 AddToPath_done Push $1; Push $3; Call StrStr Pop $2 Str

8、Cmp $2 AddToPath_done Call IsNT Pop $1 StrCmp $1 1 AddToPath_NT ; Not on NT StrCpy $1 $WINDIR 2 FileOpen $1 $1autoexec.bat a FileSeek $1 -1 END FileReadByte $1 $2 IntCmp $2 26 0 +2 +2 # DOS EOF FileSeek $1 -1 END # write over EOF FileWrite $1 $r$nSET PATH=%PATH%;$3$r$n FileClose $1 SetRebootFlag tru

9、e Goto AddToPath_done AddToPath_NT: ReadRegStr $1 $WriteEnvStr_RegKey PATH StrCmp $1 AddToPath_NTdoIt Push $1 Call Trim Pop $1 StrCpy $0 $1;$0 AddToPath_NTdoIt: WriteRegExpandStr $WriteEnvStr_RegKey PATH $0 SendMessage $HWND_BROADCAST $WM_WININICHANGE 0 STR:Environment /TIMEOUT=5000 AddToPath_done:

10、Pop $3 Pop $2 Pop $1 Pop $0FunctionEnd ; RemoveFromPath - Remove a given dir from the path; Input: head of the stack Function un.RemoveFromPath Exch $0 Push $1 Push $2 Push $3 Push $4 Push $5 Push $6 IntFmt $6 %c 26 # DOS EOF Call un.IsNT Pop $1 StrCmp $1 1 unRemoveFromPath_NT ; Not on NT StrCpy $1

11、$WINDIR 2 FileOpen $1 $1autoexec.bat r GetTempFileName $4 FileOpen $2 $4 w GetFullPathName /SHORT $0 $0 StrCpy $0 SET PATH=%PATH%;$0 Goto unRemoveFromPath_dosLoop unRemoveFromPath_dosLoop: FileRead $1 $3 StrCpy $5 $3 1 -1 # read last char StrCmp $5 $6 0 +2 # if DOS EOF StrCpy $3 $3 -1 # remove DOS E

12、OF so we can compare StrCmp $3 $0$r$n unRemoveFromPath_dosLoopRemoveLine StrCmp $3 $0$n unRemoveFromPath_dosLoopRemoveLine StrCmp $3 $0 unRemoveFromPath_dosLoopRemoveLine StrCmp $3 unRemoveFromPath_dosLoopEnd FileWrite $2 $3 Goto unRemoveFromPath_dosLoop unRemoveFromPath_dosLoopRemoveLine: SetReboot

13、Flag true Goto unRemoveFromPath_dosLoop unRemoveFromPath_dosLoopEnd: FileClose $2 FileClose $1 StrCpy $1 $WINDIR 2 Delete $1autoexec.bat CopyFiles /SILENT $4 $1autoexec.bat Delete $4 Goto unRemoveFromPath_done unRemoveFromPath_NT: ReadRegStr $1 $WriteEnvStr_RegKey PATH StrCpy $5 $1 1 -1 # copy last char StrCmp $5 ; +2 # if last char != ; StrCpy $1 $1; # append ; Push $1 Push $0; Call un.StrStr ; Find $0; in $1 Pop $2 ; pos of our dir StrCmp $2 unRemo

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 大杂烩/其它

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号