zoukankan      html  css  js  c++  java
  • java将第三方jar包打进主程序形成可运行jar包(转)

    文件页里找到build.xml文件,打开在</project>前 加入以下代码保存之

    复制代码
        <target name="package-for-store" depends="jar">
    
            <!-- Change the value of this property to be the name of your JAR,
                 minus the .jar extension. It should not have spaces.
                 <property name="store.jar.name" value="MyJarName"/>
            -->
            <property name="store.jar.name" value="SwitchHexAndChinese"/>
    
    
            <!-- don't edit below this line -->
    
            <property name="store.dir" value="store"/>
            <property name="store.jar" value="${store.dir}/${store.jar.name}.jar"/>
    
            <echo message="Packaging ${application.title} into a single JAR at ${store.jar}"/>
    
            <delete dir="${store.dir}"/>
            <mkdir dir="${store.dir}"/>
    
            <jar destfile="${store.dir}/temp_final.jar" filesetmanifest="skip">
                <zipgroupfileset dir="dist" includes="*.jar"/>
                <zipgroupfileset dir="dist/lib" includes="*.jar"/>
    
                <manifest>
                    <attribute name="Main-Class" value="${main.class}"/>
                </manifest>
            </jar>
    
            <zip destfile="${store.jar}">
                <zipfileset src="${store.dir}/temp_final.jar"
                excludes="META-INF/*.SF, META-INF/*.DSA, META-INF/*.RSA"/>
            </zip>
    
            <delete file="${store.dir}/temp_final.jar"/>
    
        </target>
    复制代码

    build.xml右键即可打包生成SwitchHexAndChinese.jar

    生成的文件

  • 相关阅读:
    WebSocket
    Redis
    Memcached
    Python实现支付宝在线支付
    RabbitMQ
    linux内核优化
    kafka资源
    推荐相关
    机器学习好网站
    逻辑回归(logistic regression)的本质——极大似然估计
  • 原文地址:https://www.cnblogs.com/yican/p/4244823.html
Copyright © 2011-2022 走看看