Open main menu

UESPWiki β

Skyrim Mod:SkyProc/How to List/BundlingJAR

< Mod / Skyrim: Skyrim Mod: SkyProc

How to... Bundle everything into one JAR for distributionEdit

The correct way to do this is using custom compiler code, not NetBeans' built in functionality.

This custom code bundles all the .jar files necessary together into one file. This single jar is then self-sufficient, and doesn't need an accompanying /lib folder. It also doesn't screw up other SkyProc programs.

To use this custom compiling code included in the starter project, follow these initializing steps:

  • Go to the Files tab in Netbeans.
  • Open up build.xml
  • Paste the following code BEFORE </project>:
   <target name="SkyProc-dist" 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="My Patcher"/>


        <!-- 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>
  • Change "My Patcher" to the patcher filename you desire (.jar suffix exluded)
  • Confirm that </project> is after the code pasted.
  • Save build.xml


After you've done the initializing steps, anytime you want to make a new .jar file to upload (your first time, or just an update), do the following:

  • Go to the Files tab in Netbeans
  • Right click build.xml
  • Click "Run Target" -> "Other Targets" -> "SkyProc-dist"

The .jar file will be created in the store/ folder in your project folder.

Related ArticlesEdit