简体   繁体   English

VLCJ Java Applet将无法加载

[英]VLCJ Java Applet will not load

I am trying to compile a vlcj application into a java applet. 我正在尝试将vlcj应用程序编译为java applet。 I have the 3 jar files needed for vlcj to run in /lib . 我有vlcj在/lib运行所需的3个jar文件。 And my class file in /src . 我的类文件在/src In eclipse, the applet works fine in the applet viewer. 在eclipse中,applet在applet查看器中运行良好。 But when I package the jar file and load up my test html page. 但是当我打包jar文件并加载我的测试html页面时。 Nothing happens! 什么都没发生! I know the applet requires being signed due to the sand-boxing of java applets. 我知道applet需要签名,因为java applets的沙盒。 And have signed the applet but I surely must be doing something wrong. 并签署了applet,但我肯定一定做错了。

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. 1)因此,首先要创建applet,然后将.java文件编译为.class文件,并将.class文件存储在/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 2)然后我创建我的jar文件

jar cvf Test.jar lib/* Test.class

3) I then generate the keys with: keytool 3)然后我生成密钥: keytool

4) I then sign the Test.jar file with jarsigner to produce SignedTest.jar . 4)然后我用jarsigner签署Test.jar文件以生成SignedTest.jar

5) I then Export the public key to certificate 5)然后我将公钥导出到证书

6) and then import that certificate as a trusted certificate. 6)然后将该证书导入为可信证书。

My Test html page open the java applet with: My Test html页面用以下命令打开java applet:

<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? 谁知道如何在Linux中获得控制台输出?

--- Edit --- ---编辑---

This is the structure of the Signed Jar File. 这是签名Jar文件的结构。

   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

Maybe Test.class never gets added to the .jar file? 也许Test.class永远不会被添加到.jar文件中? Because Eclipse puts the .class file into /bin/Test.class, and you are trying to add /Test.class 因为Eclipse将.class文件放入/bin/Test.class,并且您尝试添加/Test.class

To check, try 要检查,请尝试

    jar tvf Test.jar

after step 2. 在第2步之后。

Try using Eclipse to create the Jar. 尝试使用Eclipse创建Jar。 File | 档案| Export | 出口| Java | Java | Jar file. Jar文件。

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. 需要将包含uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent的Jar添加到applet的运行时类路径中。 That is achieved via the archive attribute of the applet element. 这是通过applet元素的archive属性实现的。 It should be a comma delimited list of Jars that are required for the applet. 它应该是applet所需的以逗号分隔的Jars列表。 Based on the compilation details and assuming they are all in the same directory as the HTML, might lead to this applet element. 根据编译细节并假设它们都与HTML在同一目录中,可能会导致此applet元素。

<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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM