cancel
Showing results for 
Search instead for 
Did you mean: 

Create an applet

indsev
Champ in-the-making
Champ in-the-making
Hi!
I'm trying to insert an applet in login.jsp. I've written the .class, and added to login.jsp the following:
<APPLET CODE="Mouse1.class" WIDTH=150 HEIGHT=25></APPLET>
However, the applet isn't loaded, and an error appears:

java.lang.ClassFormatError: Incompatible magic value 218762506 in class file Mouse1
   at java.lang.ClassLoader.defineClass1(Native Method)
   at java.lang.ClassLoader.defineClass(Unknown Source)
   at java.security.SecureClassLoader.defineClass(Unknown Source)
   at sun.applet.AppletClassLoader.findClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at sun.applet.AppletClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at sun.applet.AppletClassLoader.loadCode(Unknown Source)
   at sun.applet.AppletPanel.createApplet(Unknown Source)
   at sun.plugin.AppletViewer.createApplet(Unknown Source)
   at sun.applet.AppletPanel.runLoader(Unknown Source)
   at sun.applet.AppletPanel.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)

Can anyone help me? If I do the same outside Alfresco, it works fine.
Thank you!
6 REPLIES 6

gavinc
Champ in-the-making
Champ in-the-making
This is more than likely a compilation issue with your class, was it compiled with an older JDK?

indsev
Champ in-the-making
Champ in-the-making
Thank you for your answer.
It was compiled with jdk1.5.0_08, but I don't think it has nothing to do with the version, because the same applet works if I use it outside Alfresco.
Anyway, do you think I should use another version?

gavinc
Champ in-the-making
Champ in-the-making
I'm not sure to be honest, just googling your error message seemed to suggest a compatibility question. It is strange that you say it worked outside Alfresco as an applets evironment is governed by the browser.

indsev
Champ in-the-making
Champ in-the-making
I've found the problem:
The applet doesn't work in login.jsp, but however, it works in any other .jsp which is situated in another level, for example dialog/delete.jsp.
It's strange, isn't it? So, as I need the applet in login.jsp, I'm trying to redirect this page to another situated under jsp/dialog. I hope it works.
Thank you for your help!

indsev
Champ in-the-making
Champ in-the-making
I tried that and it's impossible: login.jsp can't redirect to another page, so there's a big problem, as I need to execute the applet in the login page.
Can anyone help me? It's really important.

gavinc
Champ in-the-making
Champ in-the-making
I wonder whether it has anything to do with authentication, as you are trying to put it on your login page you won't have authenticated, the browser will make a request for the applet class files which is probably going through one of the authentication filters, that is probably doing a redirect to the login page, hence the weird error about "Incompatible magic value".

Where are the class files stored? Try putting them on the root of your server or outside the "/faces" URL.