• linux下解压war格式的包


    linux解压 .war 

    war格式的包可以解决web应用程序部署时候不用按照目录层次结构部署,而是将war包当作部署单元来使用。

    下面就讲下怎么去解压 .war 格式的压缩包:

    1、安装jdk,我安装的是jdk1.7_64版本的,我在百度网盘上传一份,下载地址是:http://pan.baidu.com/s/1jGs22KQ

    2、jdk下载完之后先解压到指定目录下(目录视自己情况而定,我为了方面直接放在root目录下了,下面再做配置文件也是根据这个目录而进行的)

    [root@localhost ~]# ls

    an                install.log         jdk-7u76-linux-x64.gz           mnt3                          下载    文档  视频

    anaconda-ks.cfg   install.log.syslog   mydx_v.2.3.5_PR_15072502.war  公共的  桌面  音乐

    anzhuangruanjian        mnt                             myipt.rule   

                     图片    模板

    3、解压jdk-7u76-linux-x64.gz  

    tar xvf jdk-7u76-linux-x64.gz 

    jdk1.7.0_76/include/linux/jni_md.h

    jdk1.7.0_76/include/jawt.h

    jdk1.7.0_76/include/jvmticmlr.h

    jdk1.7.0_76/include/classfile_constants.h

    [root@localhost ~]# ls

    an                install.log         jdk-7u76-linux-x64.gz           mnt3                          下载    文档  视频

    anaconda-ks.cfg   install.log.syslog  mydx_v.2.3.5_PR_15072502.war  公共的  桌面  音乐

    anzhuangruanjian  jdk1.7.0_76         mnt                             myipt.rule 

    4、进入jdk1.7.0_76

    [root@localhost jdk1.7.0_76]# cd 

        在环境变量中配置jdk的家目录

    [root@localhost ~]# vim /etc/profile

    pathmunge /usr/sbin after

        pathmunge /sbin after

    fi

    HOSTNAME=`/bin/hostname 2>/dev/null`

    HISTSIZE=1000

    if [ "$HISTCONTROL" = "ignorespace" ] ; then

        export HISTCONTROL=ignoreboth

    else

        export HISTCONTROL=ignoredups

     46 

     47 HOSTNAME=`/bin/hostname 2>/dev/null`

     48 HISTSIZE=1000

     49 if [ "$HISTCONTROL" = "ignorespace" ] ; then

     50     export HISTCONTROL=ignoreboth

     51 else

     52     export HISTCONTROL=ignoredups

     53 fi

     54 

     55 export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL

     56 export PATH=$PATH:/usr/local/mysql/bin

    添加下面的代码,目录根据自己的情况而定:

    =====================================================

     57 JAVA_HOME=/root/jdk1.7.0_76

     58 JRE_HOME=/root/jdk1.7.0_76/jre

     59 PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin

     60 CLASSPATH=.:$JAVA_HOME/lib/jt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib

     61 export JAVA_HOME JRE_HOME PATH CLASSPATH

     

    =======================================================

     62 # By default, we want umask to get set. This sets it for login shell

     63 # Current threshold for system reserved uid/gids is 200

     64 # You could check uidgid reservation validity in

     65 # /usr/share/doc/setup-*/uidgid file

     66 if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then

     67     umask 002

     68 else

     69     umask 022

     70 fi

     71 

     72 for i in /etc/profile.d/*.sh ; do

     73     if [ -r "$i" ]; then

     74         if [ "${-#*i}" != "$-" ]; then

     75             . "$i"

     76         else

    5、保存之后查看jdk是不是配置成功

    命令

    java -version

    [root@localhost ~]# java -version

    java version "1.7.0_76"

    Java(TM) SE Runtime Environment (build 1.7.0_76-b13)

    Java HotSpot(TM) 64-Bit Server VM (build 24.76-b04, mixed mode)   

    出现这个结果就说明是配置成功

    6、解压war

    命令:  jar

    参数:

    -c  创建war

    -v  显示创建过程信息

    -u  更新war

    -xvf 提取war中的内容

    简单就知道这些命令

    现在就要解压war包了,需要用到

    jar -vxf ceshi.war

    [root@localhost ~]# jar -xvf ceshi.war 

     inflated: META-INF/MANIFEST.MF

      created: META-INF/

      created: WEB-INF/

      created: WEB-INF/classes/

      created: WEB-INF/classes/com/

      created: WEB-INF/classes/com/mydx/

      created: WEB-INF/classes/com/mydx/action/

     inflated: WEB-INF/classes/com/mydx/action/UploadAction.class

     inflated: WEB-INF/classes/struts.xml

      created: WEB-INF/lib/

     inflated: WEB-INF/lib/CCP_REST_SDK_JAVA_v2.6.3r.jar

     inflated: WEB-INF/lib/antlr-2.7.7.jar

     inflated: WEB-INF/lib/aopalliance-1.0.jar

     inflated: WEB-INF/lib/asm-5.0.2.jar

     inflated: WEB-INF/lib/asm-commons-5.0.2.jar

     inflated: WEB-INF/lib/asm-tree-5.0.2.jar

     inflated: WEB-INF/lib/bccs-api-lib-1.1.2.jar

     inflated: WEB-INF/lib/c3p0-0.8.5.2.jar

     inflated: WEB-INF/lib/cglib-nodep-2.1_3.jar

     inflated: WEB-INF/lib/ckeditor-java-core-3.5.3.jar

     inflated: WEB-INF/lib/classworlds-1.1.jar

     inflated: WEB-INF/lib/common_new.jar

     inflated: WEB-INF/lib/commons-beanutils-1.7.0.jar

     inflated: WEB-INF/lib/commons-chain-1.2.jar

     inflated: WEB-INF/lib/commons-collections-3.2.jar

     inflated: WEB-INF/lib/commons-digester-2.0.jar

     inflated: WEB-INF/lib/commons-fileupload-1.2.1.jar

     inflated: WEB-INF/lib/commons-io-1.3.2.jar

     inflated: WEB-INF/lib/commons-lang-2.4.jar

     inflated: WEB-INF/lib/commons-lang3-3.2.jar

     inflated: WEB-INF/lib/commons-logging-1.0.4.jar

     inflated: WEB-INF/lib/commons-logging-1.1.jar

     inflated: WEB-INF/lib/commons-logging-api-1.1.jar

     inflated: WEB-INF/lib/commons-net-ftp-2.0.jar

     inflated: WEB-INF/lib/commons-validator-1.3.1.jar

     inflated: WEB-INF/lib/dom4j-1.6.1.jar

     inflated: WEB-INF/lib/dwr.jar

    解压打当前目录了

    那么如何解压到指定目录呢?由于jar命令不支持直接指定解压到某个目录,但是可以先创建一个目录,在此目录里面执行下面命令:

    jar -xvf ../ceshi.war

       [root@localhost ~]# mkdir ceshi

    [root@localhost ~]# cd ceshi

    [root@localhost ceshi]# pwd

    /root/ceshi

                    

     [root@localhost ceshi]# jar -xvf ../ceshi.war 

     inflated: META-INF/MANIFEST.MF

      created: META-INF/

      created: WEB-INF/

      created: WEB-INF/classes/

      created: WEB-INF/classes/com/

      created: WEB-INF/classes/com/mydx/

      created: WEB-INF/classes/com/mydx/action/

     inflated: WEB-INF/classes/com/mydx/action/UploadAction.class

     inflated: WEB-INF/classes/struts.xml

      created: WEB-INF/lib/

    /lib/commons-logging-api-1.1.jar

     inflated: WEB-INF/lib/commons-net-ftp-2.0.jar

     inflated: WEB-INF/lib/commons-validator-1.3.1.jar

     inflated: WEB-INF/lib/dom4j-1.6.1.jar

     inflated: WEB-INF/lib/dwr.jar

     inflated: WEB-INF/lib/ezmorph-1.0.4.jar

     inflated: WEB-INF/lib/freemarker-2.3.16.jar

     inflated: WEB-INF/lib/hibernate-c3p0-4.1.2.Final.jar

     inflated: WEB-INF/lib/hibernate-commons-annotations-4.0.1.Final.jar

     inflated: WEB-INF/lib/hibernate-core-4.1.4.Final.jar

     inflated: WEB-INF/lib/hibernate-entitymanager-4.1.4.Final.jar

    [root@localhost ceshi]# ls

    index.jsp  js  META-INF  upload  WEB-INF

    这些文件就是解压出来的。

                  完

  • 相关阅读:
    排序算法【java实现】(二)冒泡排序和简单选择排序
    排序算法【java实现】(一)直接插入排序
    Html中行内元素和块级元素有哪些?
    设计模式--单例模式(二)双重校验锁模式
    设计模式--单例模式(一)懒汉式和饿汉式
    给定一个字符串数组{"nba","abc","cba","zz","qq","haha"},请按照字典顺序进行从小到大的排序。
    请统计"nba"在字符串"nbaernbatynbauinbaopnba"中出现的次数
    java string方法
    css中的颜色值
    jquery动画效果中,避免持续反应用户的连续点击
  • 原文地址:https://www.cnblogs.com/itor/p/4675751.html
Copyright © 2020-2023  润新知