For all of you who have this same problem:
First, you will have to add a MANIFEST.MF
file to your applet. Check: Simpliest way to add an attribute to a jar Manifest in Maven for a way for signing and adding the manifest file to your applet. Make sure that this configuration isn't override in the applet parameters configurations.
Java 8+ requires signed applets, so you will have to sign your applet. If you are in a development environment you will have to self-sign your applet and add this certificate to the Java Control Panel. See this for a way to add Self-Signed Certificates to the List of Trusted Certificates in the Java Runtime .
Even after that, there is some code that will run only with PrivilegedActions
. See this answer: https://stackoverflow.com/a/1730904/2692914.
Anyway, this is how I have done this, I've used this Minimal Java Applet built with Maven as a base project.
MANIFEST.MF
Manifest-Version: 1.0
Application-Name: One Applet
Codebase: *
Permissions: all-permissions
Application-Library-Allowable-Codebase: *
Caller-Allowable-Codebase: *
Trusted-Only: false
Trusted-Library: false
pom.xml
<build>
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<index>true</index>
<manifestFile>${project.basedir}/MANIFEST.MF</manifestFile>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
</archive>
</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-jarsigner-plugin</artifactId>
<version>1.2</version>
<configuration>
<keystore>src/main/resources/minimal-keystore.jks</keystore>
<alias>minimal</alias>
<storepass>abcd1234</storepass>
<keypass>abcd1234</keypass>
</configuration>
<executions>
<execution>
<id>sign</id>
<goals>
<goal>sign</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
...
</plugins>
</build>
minimal.cer
keytool -export -keystore minimal-keystore.jks -alias minimal -file minimal.cer

SomeClass.java
try {
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
try {
for (String dll : dlls) {
String dllPath = basePath + dll;
System.out.println("Cargando: " + dllPath);
System.load(dllPath);
}
return null;
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
});
} catch (Exception e) {
e.printStackTrace();
throw e;
}
Well, that's it!