使用IzPack打包JAVA Web应用程序

使用IzPack打包JAVA Web应用程序步骤如下:

 

这里使用IzPack-4.3.5 + launch4j-3.1.0-beta1-win32.zip(绿色版)对Web应用程序打包,打包后即可对我们使用java开发的Web应用程序进行安装部署。

 

操作步骤:

1. 首先先下载IzPack-install-4.3.5.jar可执行的Jar包,该安装包就是通过IzPack做成的,是一个可执行的Jar包。下载后通过命令java –jar IzPack-install-4.3.5.jar 运行运行安装。

 

2. 安装IzPack软件的目录如下:


3. 最开始你可以通过安装包目录中sample了解IzPack最初的用法。

4. 整理需要打包的文件,打包web项目也就是对web服务器、web项目、绿色的mysql数据库、可运行的jre进行打包处理,先整理收集这些软件。

5. 通过IzPack对Web应用程序进行打包处理:

(1). 首先整理好需要打包软件及文件放入到IzPack目录下sample目录中,这里我创建一个目录是olfspdrs名称,在例子目录中拷贝一个install.xml进行配置;

(2). 其实打包处理是通过IzPack安装目录下bin目录中compile.bat执行olfspdrs目录中配置好的install.xml文件。

(3). 配置install.xml文件,该文件可配置安装程序目录的名称,安装语言,安装界面,及要打包安装的程序等等,具体使用需要参照安装目录下doc目录。

(4). 执行命令生成可执行jar文件,进入bin目录,然后cmd运行命令:

Compile D:\ProgramFiles\IzPack\sample\olfspdrs\install.xml 命令


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

<!-- 
    A sample installation file.
    Use it as a base for your own installers :-)
    To compile it :
    - go in the bin directory where you installed IzPack
    - call "compile ../sample/install.xml -b ../sample"
-->

<installation version="1.0">

    <!-- 
        The info section.
        The meaning of the tags should be natural ...
    -->
    <info>
        <appname>可研初设评审业务管理系统_离线版</appname>
        <appsubpath>OL_FSPDRS</appsubpath>	
        <appversion>1.0.BETA</appversion>
        <authors>
            <author name="北京博超时代软件有限公司(JAVA项目部)" email="bc@bochao.com.cn"/>
        </authors>
        <url>http://www.bochao.com.cn</url>
		<javaversion>1.6</javaversion>
		<requiresjdk>no</requiresjdk>
    </info>
    
    <!-- 
        The gui preferences indication.
        Sets the installer window to 540x380. It will not be able to change the size.
    -->

	<guiprefs width="600" height="480" resizable="no">
	  <!-- 定义是否显示语言国旗标志 -->
	  <modifier key="useFlags" value="yes"/>
	  <!-- 语言显示类型 -->
	  <modifier key="langDisplayType" value="NORTHWEST"/>
	  <!-- 是否显示按钮图标 -->
	  <modifier key="useButtonIcons" value="yes"/>
	  <!-- 是否显示文本标签图标 -->
	  <modifier key="useLabelIcons" value="yes"/>
	  <!-- 布局锚点 -->
	  <modifier key="layoutAnchor" value="NORTH"/>
	  
	  <modifier key="labelGap" value="2"/>
	  <modifier key="useHeadingPanel" value="yes"/>
	  <modifier key="headingImageOnLeft" value="yes"/>
	  <modifier key="useHeadingForSummary" value="yes"/>
	  <modifier key="headingLineCount" value="1"/>
	  <modifier key="headingFontSize" value="1.5"/>
	  <modifier key="headingBackgroundColor" value="0x00ffffff"/>
	  <modifier key="headingPanelCounter" value="progressbar"/>
	  <modifier key="headingPanelCounterPos" value="inNavigationPanel"/>
	</guiprefs>


    <!-- 
        The locale section.
        Asks here to include the Chinese and French langpacks.
    -->
    <locale>
        <langpack iso3="chn"/>
        <langpack iso3="eng"/>
    </locale>

    <!-- 
        The resources section.
        The ids must be these ones if you want to use the LicencePanel and/or the InfoPanel.
    -->
    <resources>
   		<res id="LicencePanel.licence" src="Licence.txt"/>
        <res id="InfoPanel.info" src="Readme.txt"/>
    	<res id="installer.langsel.img" src="Images/langsel.jpg"/>
    	<res id="Installer.image.0" src="Images/image-0.png"/>
        <res id="Installer.image.1" src="Images/image-1.png"/>
        <res id="Installer.image.2" src="Images/image-2.png" />
        <res id="Installer.image.3" src="Images/image-3.png" />
        <res id="Installer.image.4" src="Images/image-4.png"/>
        <res id="Installer.image.5" src="Images/image-5.png"/>
        <res id="Installer.image.6" src="Images/image-6.png"/>
        <res id="Installer.image.7" src="Images/image-7.png"/>
        <res id="Installer.image.8" src="Images/image-8.png"/>
        <res id="shortcutSpec.xml" src="shortcutSpec-x86.xml"/>
        <res id="ProcessPanel.Spec.xml" src="ProcessPanel-x86.Spec.xml"/>
		<res id="setx.vbs" src="bin-x86\setx.vbs"/>
  		<res id="coreId" src="Images/core.png"/>
  		<res id="documentId" src="Images/document.png"/>
    </resources>
    
    <!-- 定义变量 -->
    <variables>
		<variable name="DesktopShortcutCheckboxEnabled" value="true"/>
        <variable name="ApplicationShortcutPath" value="ApplicationShortcuts"/>
	</variables>
    
    <!-- 
        The panels section.
        We indicate here which panels we want to use. The order will be respected.
    -->
    <panels>
        <panel classname="HelloPanel"/>
        <panel classname="InfoPanel"/>
        <panel classname="LicencePanel"/>
        <panel classname="TargetPanel"/>
        <panel classname="ImgPacksPanel"/>
        <panel classname="SummaryPanel"/>
        <panel classname="InstallPanel"/>
        <panel classname="ProcessPanel"/>
        <panel classname="ShortcutPanel" id="shortcutpanel"/>
        <panel classname="SimpleFinishPanel"/>
    </panels>

    <!-- 
        The packs section.
        We specify here our packs.
    -->
    <packs>
    
    	<!-- 基本数据文件 -->
        <pack name="核心文件" required="yes" packImgId="coreId">
            <description>核心文件</description>
            <file src="Readme.txt" targetdir="$INSTALL_PATH"/>
            <file src="Licence.txt" targetdir="$INSTALL_PATH"/>
            <file src="bin-x86" targetdir="$INSTALL_PATH"/>
            <file src="log" targetdir="$INSTALL_PATH"/>
            <file src="i18n" targetdir="$INSTALL_PATH"/>
            <file src="Images" targetdir="$INSTALL_PATH"/>
            <parsable targetfile="$INSTALL_PATH/bin-x86/install_deploy.bat"/>
        </pack>
        
        <!-- 离线评审系统服务器 -->
        <pack name="系统服务器" required="yes">
            <description>离线评审系统</description>
            <file src="tomcat-7.0.47-x86-fspdrs" targetdir="$INSTALL_PATH"/>
        </pack>
        
        <!-- 文件系统服务器 -->
        <pack name="文件服务器" required="yes">
            <description>文件系统</description>
            <file src="tomcat-7.0.47-x86-fsserver" targetdir="$INSTALL_PATH"/>
        </pack>
      
        <!-- 运行环境 -->
        <pack name="运行环境[JAVA]" required="yes">
        	<description>JAVA运行环境</description>
        	<file src="Java-86" targetdir="$INSTALL_PATH"/>
        </pack>
        
        <!-- 数据库目录 -->
        <pack name="数据库[MYSQL]" required="yes">
        	<description>数据库系统</description>
        	<file src="mysql5.1-x86" targetdir="$INSTALL_PATH"/>
        </pack>
        
        <!-- 帮助手册 -->
        <pack name="帮助手册[可选]" required="no" packImgId="documentId">
            <description>帮助手册</description>
            <file src="manual" targetdir="$INSTALL_PATH"/>
        </pack>
        
        <!-- 调用本地库 -->
        <native type="izpack" name="ShellLink.dll"/>
        
    </packs>
    
</installation>


编译该xml命令如下:


compile ../sample/olfspdrs/install_x86.xml -b ../sample/olfspdrs


 

6. 使用launch4j对可运行的jar文件包装为exe文件:

(1). Launch4j是个绿色软件,直接解压后即可,解压后目录如下:

(2).双击launch4j.jar可运行jar文件配置如下:


(3).配置好该界面后,点击“小齿轮”图标即可在执行目录生成安装包可执行.exe文件

(4).由于java可运行的jar文件执行时候需要jre文件,故安装文件目录应该一直包含jre目录。

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值