简体   繁体   中英

Magic value error when I run my applet

I create an Applet and I generate the jar file with the following code

JAR FILE

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

I put the JAR file in a visible HTTP ( http://www.netimoveis.com/AbrirAplicativo3000.jar )

In my ASPX page, I'm calling the APPLET following this code

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

"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. However I did download the jar with your supplied URL so just try re-packaging it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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