I have the following code in a HTML page
<applet code="com.griaule.fingerprintsdk.appletsample.FormMain"
archive="SignedFingerprintSDKJava.jar, AbrirAplicativoAssinado.jar"
width="515" height="560">
</applet>
When I run my html page, a got an error that says, "ClassNotFoundException, FormMain.class"
I run jarscan and I found the class FormMain in my jar file.
What happened ?
This is how I generate my jar file
jar cvf C:\Users\lucas\desktop\AbrirAplicativo.jar C:\Users\lucas\workspace\applet-chave\bin\com\griaule\fingerprintsdk\appletsample\AppletInstaller.class C:\Users\lucas\workspace\applet-chave\bin\com\griaule\fingerprintsdk\appletsample\ColorPane.class C:\Users\lucas\workspace\applet-chave\bin\com\griaule\fingerprintsdk\appletsample\FormMain.class C:\Users\lucas\workspace\applet-chave\bin\com\griaule\fingerprintsdk\appletsample\FormOptions.class C:\Users\lucas\workspace\applet-chave\bin\com\griaule\fingerprintsdk\appletsample\Util.class
Generate keys
keytool -genkey -dname "cn=AbrirAplicativoApplet, ou=XXX, o=XXX, l=São Paulo, s=SP c=BR" -alias AbrirAplicativoAppletKey -keystore C:\ChaveAbrirAplicativoApplet -storepass 123456 -validity 7300
Assign Jar File
jarsigner -keystore C:\users\lucas\desktop\ChaveAbrirAplicativoApplet -storepass 123456 -signedjar "C:\Users\lucas\Desktop\AbrirAplicativoAssinado.jar" "C:\Users\lucas\Desktop\AbrirAplicativo.jar" AbrirAplicativoAppletKey
Exporting Certificate
keytool -export -keystore C:\users\lucas\desktop\ChaveAbrirAplicativoApplet -alias AbrirAplicativoAppletKey -file C:\users\lucas\desktop\CertificadoAbrirAplicativoApplet.x509
Verifying Assign
keytool -import -alias AbrirAplicativoAppletKey -file C:\CHAVES\CertificadoAbrirAplicativoApplet.x509
Maybe my problem are in the PolicyTool
When I try to put a new policy entry I got the following error
java.net.MalformedURLException: no protocol: AbrirAplicativoAssinado.jar
but how can I put a URL in this field, if my jar file are in my desktop ?
I try to put http://localhost/AbrirAplicativoAssinado.jar but occurs a new error
There is not a public key for the alias AbrirAplicativoAppletKey.
OK the “class not found” should have nothing to do with signing. I take it that the jar files reside in the same directory as the html file?
There might be a problem with the way you list multiple archives. You might try the following approaches:
,from the archive list, leaving just the space.,(including the space) by either:or;.Class-Pathproperty listing the other two archives, separated by a space. Use that file as thearchive=parameter.Class-Pathproperty of its manifest, and only list that one in thearchive=parameter.It also apepars as if the way you build yor jar file, all the class files would be placed in the root directory of the file, without internal directory structure. The directory structure in the jar file has to match the package structure of your classes, i.e. the
packagelines in your source code, and also thecode=parameter of yourapplettag.In order to create the directory structure inside your jar file, change directory to
C:\Users\lucas\workspace\applet-chave\binand then executejar cvf C:\Users\lucas\desktop\AbrirAplicativo.jar comto add the whole directorycomto the archive.