Question

I have an applet that uses several external libs. The project requires the applet JAR is signed because I perform disk operations. Another requirement is that all libs are included in the applet jar . My first attempt working this way was to include all the JARs of the libraries in a local directory of the Eclipse project and include them in the Eclipse project. After that I exported the entire project as a non-executable JAR, getting run most libs. But some libraries are still not referenced and I can not run my application via applet completely. Is there any more appropriate way to use libs inside a signed applet JAR?

Was it helpful?

Solution

If you are using maven then you can extract all classes needed. The maven plugin will do this for you. It can also sign it if you have an jks file. Here is some setup for maven.

<plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.5</source>
                <target>1.5</target>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.1</version>
            <configuration>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
            </configuration>
            <executions>
                <execution>
                    <id>make-assembly</id>
                    <phase>package</phase>
                    <goals>
                        <goal>attached</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>sign</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <keystore>${basedir}/the jks.jks</keystore>
                <alias>the alias</alias>
                <storepass>the store pass</storepass>
                <signedjar>${project.build.directory}/signed/${project.build.finalName}.jar</signedjar>
             <verify>true</verify>

               <jarPath>${project.build.directory}/${project.build.finalName}-jar-with-dependencies.${project.packaging}</jarPath>
        </configuration>
              </plugin>
    </plugins>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top