0% found this document useful (0 votes)
421 views

Use NetBeans IDE 6.7 To Combine JAR Files Into A Single JAR File

The document provides instructions for combining JAR files into a single JAR file using NetBeans IDE 6.7. It instructs the user to 1) create a Mars Rover Viewer project, 2) open the build.xml file, and 3) add code to the bottom of build.xml to define a target that will package dependent JAR files into a single JAR called MarsRoverViewer.jar.

Uploaded by

prabhusct
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
421 views

Use NetBeans IDE 6.7 To Combine JAR Files Into A Single JAR File

The document provides instructions for combining JAR files into a single JAR file using NetBeans IDE 6.7. It instructs the user to 1) create a Mars Rover Viewer project, 2) open the build.xml file, and 3) add code to the bottom of build.xml to define a target that will package dependent JAR files into a single JAR called MarsRoverViewer.jar.

Uploaded by

prabhusct
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

Use NetBeans IDE 6.

7 to Combine JAR Files Into a Single JAR File


1. Create Mars Rover Viewer project in Samples folder in NetBeans
2. Switch to Files tab, and open build.xml which is ANT script
3. Edit the file, add following text at the bottom of build.xml and before </project> tag

<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="MarsRoverViewer"/>

<!-- 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>

Note that you must change the following line in the Ant code above to match your particular project.

<property name="store.jar.name" value="MarsRoverViewer"/>

The property store.jar.name specifies the name of the JAR file that will be created in the store directory — change
the value to whatever name you like. When you done your coding, right click on the build.xml—>Run Target
—>Other Targets—>package-for-store

A folder called Store should appear in your project folder and the MarsRoverViewer.jar should sit in there
double click it and run!

You might also like