I am trying to compile a vlcj application into a java applet. I have the 3 jar files needed for vlcj to run in /lib
. And my class file in/src
. In eclipse, the applet works fine in the applet viewer. But when I package the jar file and load up my test html page. Nothing happens! I know the applet requires being signed due to the sand-boxing of java applets. And have signed the applet but I surely must be doing something wrong.
These are the steps I make:
1) So to create the applet first I compile the .java file to a .class file and store the .class file in /bin.
javac -cp lib/vlcj-2.1.0.jar:lib/platform-3.4.0.jar:lib/jna-3.4.0.jar Test.java
2) I then create my jar file with
jar cvf Test.jar lib/* Test.class
3) I then generate the keys with:keytool
4) I then sign the Test.jar
file with jarsigner
to produce SignedTest.jar
.
5) I then Export the public key to certificate
6) and then import that certificate as a trusted certificate.
My Test html page open the java applet with:
<applet code="bin/Test.class" archive="SignedTest.jar” width=200 height=200>
Are any of these steps wrong? Am I missing a stage or two? And a bonus question? Anyone know how to get console output in linux?
--- Edit ---
This is the structure of the Signed Jar File.
703 Wed Aug 22 09:25:16 BST 2012 META-INF/MANIFEST.MF
908 Wed Aug 22 09:25:16 BST 2012 META-INF/SIGNFILE.SF
782 Wed Aug 22 09:25:16 BST 2012 META-INF/SIGNFILE.DSA
500 Wed Aug 22 09:06:28 BST 2012 Test$1.class
1448 Wed Aug 22 09:06:28 BST 2012 Test.class
40 Tue Aug 14 11:36:48 BST 2012 Notes
1008730 Tue Jul 10 13:15:48 BST 2012 lib/jna-3.4.0.jar
913436 Tue Jul 10 13:15:48 BST 2012 lib/platform-3.4.0.jar
278211 Tue Jul 10 13:15:48 BST 2012 lib/vlcj-2.1.0.jar
371 Tue Jul 10 13:23:54 BST 2012 .project
351 Tue Jul 10 13:16:18 BST 2012 .classpath
java.lang.NoClassDefFoundError: uk/co/caprica/vlcj/component/EmbeddedMediaPlayerComponent.
The Jar containing uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent
needs to be added to the run-time class-path of the applet. That is achieved via the archive
attribute of the applet
element. It should be a comma delimited list of Jars that are required for the applet. Based on the compilation details and assuming they are all in the same directory as the HTML, might lead to this applet element.
<applet
code="Test"
archive="SignedTest.jar,vlcj-2.1.0.jar,platform-3.4.0.jar,jna-3.4.0.jar"
width=200
height=200>
</applet>