你的位置:首页 > 软件开发 > Java > NetBeans将java项目编译成jar包

NetBeans将java项目编译成jar包

发布时间:2015-10-15 15:00:04
1.找到file选项下的build.2.添加代码到build.复制如下代码:<target name="package-for-store" depends="jar"> <!- ...

1.找到file选项下的build.

NetBeans将java项目编译成jar包

2.添加代码到build.

NetBeans将java项目编译成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="此处即你要打包成jar的文件名"/>

        -->

        <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='/images/loading.gif' data-original="${store.dir}/temp_final.jar" excludes="META-INF/*.SF, META-INF/*.DSA, META-INF/*.RSA"/>

        </zip>

 

        <delete file="${store.dir}/temp_final.jar"/>

 

    </target>

 

3. build.

  run target ---》other target-----》package -for-store

NetBeans将java项目编译成jar包

 

 

4.files---->store---->your jar

store文件夹下即你的目标jar包

 


 

海外公司注册、海外银行开户、跨境平台代入驻、VAT、EPR等知识和在线办理:https://www.xlkjsw.com

原标题:NetBeans将java项目编译成jar包

关键词:JAVA

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。