Lucas_Santos
Lucas_Santos

Reputation: 4740

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 ?

Upvotes: 0

Views: 254

Answers (2)

betomontejo
betomontejo

Reputation: 1665

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.

Upvotes: 1

Denys S&#233;guret
Denys S&#233;guret

Reputation: 382160

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.

Upvotes: 1

Related Questions