示例:我想在jar文件“B.jar”中注入jar文件“A.jar”
我只知道如何在jarfile中注入方法
我该怎么做?
答案 0 :(得分:0)
您可以使用Netbeans + ant执行此操作。首先,您创建一个空项目,并将所有jar作为此项目的依赖项。然后在build.xml上添加目标波纹管。转到"文件"选项卡,单击构建文件上的按钮右键并调用" package-for-store"目标
<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="mylib"/>
<!-- 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>