Manu Manu - 11 months ago 104
Java Question

how to make single jar file with including all other jar libraries in dist folder

I have created a application . In this application i have doubt that when getting output I need to include "lib"( library folder which includes all supporting jar files) but I need in a single jar files which must be include all supporting jars . is it possible ? I am using netbeans..

Answer Source

You don't tell us what you are using to build your code. I'm going to guess at maven (because I know the answer it it's Maven!). What you need is:

<build>
    <plugins>
        <plugin>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>copy-dependencies</goal>
                    </goals>
                    <configuration>
                        <includeScope>runtime</includeScope>
                        <outputDirectory>${project.build.directory}/lib</outputDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>

        <!-- Add your other plug-ins here -->

    </plugins>
</build>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download