InstallAnywhere7.1打包J2EE项目(Java+Tomcat+MySQL)

标签: InstallAnywhere  程序安装制作  Java  Tomcat  MySQL 
一.安装InstallAnywhere
    我用的版本是InstallAnywhere7.1,安装步骤简单,一直Next即可;

二.安装源文件目录
    \resources\NK-eHR
        -bin
        -jdk1.5.0_13
        -mysql5.0.45
        -tomcat5.0.28
        -LICENSE.TXT

三.开始制作J2EE安装程序包
1.运行InstallAnywhere7.1,选择路径,并命名Project。我的设置:路径:F:\SoftPack\resources\,Project名:NK-eHR,直接点击Save。







2.Project.
设置项目基本信息基本不需要动,一些项目信息看图示即明白,在console项目中调试时可设置Send stderr to 和Send stdout to为:console,最终发布可去掉;Info:设置软件的标题等信息;Description:设置软件产品版本,描述,提供商信息等;Locales:选择语言;Rules:我检查了安装软件必须的系统,CheckPlatform。



3.Install UI
设置安装的用户接口,基本可以不动,我去掉了部分不需要内容,如下图



4.Organization
设置组织方式,基本可以不动,同样我也去掉了部分不需要的,如下图:



5.Pre_Install
安装预览设置,基本不需要动,我去掉了部分不需要项目,增加了产品使用协议,如下图



6.Install
安装的项目,Addfiles进来需要打包的项目文件,Addaction增加开始菜单,注意菜单的Path项选择Program Menu,如下图


7.Post_Install
安装过程中需要的修改都在这里,很重要,请看下属文字描述:
1)修改mysql配置文件my.ini,在开头增加
[mysqld]
basedir="$USER_INSTALL_DIR$$/$mysql5.0.45/"
basedir="$USER_INSTALL_DIR$$/$mysql5.0.45/data"
default-character-set=UTF8

2)修改tomcat文件catalina.bat,在开头增加
rem -------------- Added by Naikang start... -------------------------------------------------------------
rem Set JAVA_HOME and CURRENT_DIR
set JAVA_HOME=$USER_INSTALL_DIR$$\$jdk1.5.0_13
set CURRENT_DIR=$USER_INSTALL_DIR$$\$tomcat5.0.28$\$bin
rem -------------- Added by Naikang ending... ------------------------------------------------------------

3)修改tomcat文件service.bat,在开头增加
rem -------------- Added by Naikang start... -------------------------------------------------------------
rem Set JAVA_HOME and CURRENT_DIR
set JAVA_HOME=$USER_INSTALL_DIR$$\$jdk1.5.0_13
set CATALINA_HOME=$USER_INSTALL_DIR$$\$tomcat5.0.28
rem -------------- Added by Naikang ending... ------------------------------------------------------------

4)修改tomcat文件startup.bat,在开头增加
rem -------------- Added by Naikang start... -------------------------------------------------------------
rem Set  CURRENT_DIR
set CURRENT_DIR = $USER_INSTALL_DIR$$\$tomcat5.0.28
rem -------------- Added by Naikang ending... ------------------------------------------------------------

5)修改tomcat文件shutdown.bat,在开头增加
rem -------------- Added by Naikang start... -------------------------------------------------------------
rem Set  CURRENT_DIR
set CURRENT_DIR = $USER_INSTALL_DIR$$\$tomcat5.0.28
rem -------------- Added by Naikang ending... ------------------------------------------------------------

6)Register Service: MySQL5
call "$USER_INSTALL_DIR$/mysql5.0.45/bin/mysqld.exe" --install-manual MySQL5

7)Register Service: Tomcat5
call "$USER_INSTALL_DIR$/tomcat5.0.28/bin/service.bat" install

8)Start Service: MySQL5
net start MySQL5

9)Start Service: Tomcat5
net start Tomcat5

10)Modify root password
call "$USER_INSTALL_DIR$/mysql5.0.45/bin/mysqladmin.exe" -h localhost -P 3308 -u root password "123456"

11)Initialize MySQL DB
call "$USER_INSTALL_DIR$/mysql5.0.45/bin/mysql.exe" -h localhost -P 3308 -u root -p123456 < "$USER_INSTALL_DIR$/mysql5.0.45/bin/db.mysql"





8.Post_Uninstall
卸载软件时需要对系统的操作,停止、注销mysql和tomcat服务,删除一些安装文件等,具体如下:
1)Unegister Service: MySQL5
net stop MySQL5
call "$USER_INSTALL_DIR$/mysql5.0.45/bin/mysqld.exe" --remove MySQL5
2)Unegister Service: Tomcat5
net stop Tomcat5
call "$USER_INSTALL_DIR$/tomcat5.0.28/bin/service.bat" remove
3)Delete files and directorys
del /q/s "$USER_INSTALL_DIR$/jdk1.5.0_13"
rd /q/s "$USER_INSTALL_DIR$/jdk1.5.0_13"

del /q/s "$USER_INSTALL_DIR$/mysql5.0.45"
rd /q/s "$USER_INSTALL_DIR$/mysql5.0.45"

del /q/s "$USER_INSTALL_DIR$/tomcat5.0.28"
rd /q/s "$USER_INSTALL_DIR$/tomcat5.0.28"

del /q/s "$USER_INSTALL_DIR$/bin"
rd /q/s "$USER_INSTALL_DIR$/bin"

del /q/s "$USER_INSTALL_DIR$/LICENSE.TXT"




9.Post_Unintall
基本不需要动,删除了不需要的项目,增加了卸载说明,如下图:


10.Build
开始编译,主要设置一些平台相关的东西,是否要继承jre,还有如果需要刻录成光盘的模式,可以在Distribution中设置



11.点击Build Project按钮,等吧...

原文请点击:http://yuanliyin.blog.sohu.com/73178212.html

你可能感兴趣的:(java,tomcat,.net,mysql,UI)