netbeans打包成jar

王朝学院·作者佚名  2016-08-27
窄屏简体版  字體: 小  |  中  |  大  |  超大  

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

按 Ctrl+C 复制代码

<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>按 Ctrl+C 复制代码

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

生成的文件

 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
© 2005- 王朝網路 版權所有 導航