简体   繁体   English

运行applet时出现魔术值错误

[英]Magic value error when I run my applet

I create an Applet and I generate the jar file with the following code 我创建一个Applet,然后使用以下代码生成jar文件

JAR FILE JAR文件

"c:\arquivos de programas\java\jdk1.7.0_05\bin\jar" cvf C:\Users\lucas\Desktop\AbrirAplicativo3000.jar C:\Users\lucas\workspace\WebcamApplet\bin\com\colorfulwolf\webcamapplet\WebcamApplet.class C:\Users\lucas\workspace\WebcamApplet\bin\com\colorfulwolf\webcamapplet\QRCodeProcessor.class C:\Users\lucas\workspace\WebcamApplet\bin\com\colorfulwolf\webcamapplet\QRCodeListener.class C:\Users\lucas\workspace\WebcamApplet\bin\com\colorfulwolf\webcamapplet\OpenCVWebCam.class C:\Users\lucas\workspace\WebcamApplet\bin\com\colorfulwolf\webcamapplet\CVImageProcessor.class C:\Users\lucas\workspace\WebcamApplet\bin\com\colorfulwolf\webcamapplet\AbstractProcessor.class C:\Users\lucas\workspace\WebcamApplet\bin\com\colorfulwolf\webcamapplet\gui\ImagePanel.class C:\Users\lucas\workspace\WebcamApplet\bin\com\colorfulwolf\webcamapplet\gui\LabelPanel.class C:\Users\lucas\workspace\WebcamApplet\bin\com\colorfulwolf\webcamapplet\gui\LoadingScreen.class C:\Users\lucas\workspace\WebcamApplet\bin\com\google\zxing\StringsResourceTranslator.class C:\Users\lucas\workspace\WebcamApplet\bin\com\google\zxing\client\j2se\BufferedImageLuminanceSource.class C:\Users\lucas\workspace\WebcamApplet\bin\com\google\zxing\client\j2se\CommandLineRunner.class C:\Users\lucas\workspace\WebcamApplet\bin\com\google\zxing\client\j2se\GUIRunner.class C:\Users\lucas\workspace\WebcamApplet\bin\com\google\zxing\client\j2se\ImageConverter.class C:\Users\lucas\workspace\WebcamApplet\bin\com\google\zxing\client\j2se\MatrixToImageWriter.class

and I singed the JAR file normally. 我正常地烧掉了JAR文件。

I put the JAR file in a visible HTTP ( http://www.netimoveis.com/AbrirAplicativo3000.jar ) 我将JAR文件放在可见的HTTP中( http://www.netimoveis.com/AbrirAplicativo3000.jar

In my ASPX page, I'm calling the APPLET following this code 在我的ASPX页面中,我按照此代码调用APPLET

<applet code="com.colorfulwolf.webcamapplet.WebcamApplet" 
    archive="http://www.netimoveis.com/AbrirAplicativo3000.jar, http://www.netimoveis.com/AbrirAplicativoAssinado3000.jar"
    height="550" width="550">
</applet>

But when I try to run, I got the error 但是当我试图跑步时,我得到了错误

Incompatible magic value 218774561 error in applet

Someone can help me ? 有人可以帮帮我吗?

The magic value error means that the class file doesn't start with the integer 0xCAFEBABE as it should. 魔术值错误意味着类文件不以整数0xCAFEBABE开头。 You probably had a transfer or compression problem. 您可能遇到转移或压缩问题。

If you can open the file in an hex editor, you may look for those bytes. 如果您可以在十六进制编辑器中打开文件,则可以查找这些字节。

Your AbrirAplicativo3000.jar is not correctly packaged. 您的AbrirAplicativo3000.jar未正确打包。 If you look inside, it has this structure: 如果你看看里面,它有这样的结构:

META-INF/
C:/
  Users/
    lucas/
      workspace/
        WebcamApplet/
           bin/
             com/ --> this is where the jar should start from.
               ...

Try using the -C option on the jar command like this: 尝试在jar命令中使用-C选项,如下所示:

"c:\arquivos de programas\java\jdk1.7.0_05\bin\jar" cvf C:\Users\lucas\Desktop\AbrirAplicativo3000.jar -C C:\Users\lucas\workspace\WebcamApplet\bin\ .

Also it's not the first time that this magic number comes up on SO, although it seems more related with a bad URL. 此外,这不是第一次出现这个神奇的数字 ,虽然它看起来与一个糟糕的URL有关。 However I did download the jar with your supplied URL so just try re-packaging it. 但是我确实用你提供的URL下载了jar ,所以试试重新打包它。

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

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