Results 1 to 8 of 8
  1. #1
    IamKira is offline Member
    Join Date
    Jul 2009
    Posts
    11
    Rep Power
    0

    Default Deploying an applet with jsp

    Hi,

    I am trying to make an applet accessible through a JSP, but it won't load, I have the following error in my browser's Java console:

    java.lang.ClassFormatError: Incompatible magic value 1013461310 in class file MyApplet

    ...

    The applet is in the same directory of the JSP that calls it wich is the root of the project. Here's the code in the JSP:
    Java Code:
    <jsp: plugin type="applet" codebase="." code="MyApplet.class" width="408" height="410" >
        <jsp:fallback>
            Plugin tag OBJECT or EMBED not supported by browser.
        </jsp:fallback>
    </jsp: plugin>

    There are no preblems when I call the applet from a usual html file with the applet tag.

    What am I doing wrong?

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    What does the applet tag look like in the html page that works, and what does the tag look like from the jsp page as displayed on the browser?

  3. #3
    IamKira is offline Member
    Join Date
    Jul 2009
    Posts
    11
    Rep Power
    0

    Default

    Hi,

    html code that works :

    <applet codebase="." code="MyApplet.class" width="408" height="410"></applet>



    JSP generated code in the browser :

    <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" width="408" height="410" codebase="http://java.sun.com/products/plugin/1.2.2/jinstall-1_2_2-win.cab#Version=1,2,2,0">
    <param name="java_code" value="MyApplet.class">
    <param name="java_codebase" value=".">
    <param name="type" value="application/x-java-applet;version=1.1">
    <comment>
    <EMBED type="application/x-java-applet;version=1.1" width="408" height="410" pluginspage="http://java.sun.com/products/plugin/" java_code="MyApplet.class" java_codebase="."/>
    <noembed>

    Plugin tag OBJECT or EMBED not supported by browser.

    </noembed>
    </comment>
    </object>


    This is the first time I try to include an applet in a JSP and I am not familiar to the object tag, sorry if there's anything wrong that is too obvious.
    Last edited by IamKira; 01-27-2010 at 03:33 PM.

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    I've not used <plugin>, and I haven't done an applet in well over 5 years.

    I'd look into what's expected for <object> and then try and hand code that one in the html page and get it to work. Then you might have a better idea of what's expected by <plugin>, or what it's doing.

  5. #5
    IamKira is offline Member
    Join Date
    Jul 2009
    Posts
    11
    Rep Power
    0

    Default

    This is strange. Sun says that the object tag should be use to deploy applets that are to be used only with internet explorer.

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    Well, <plugin> decides (based on the client browser) whether to use <object> or <embed>. So presumably you were using an IE-like browser.

  7. #7
    IamKira is offline Member
    Join Date
    Jul 2009
    Posts
    11
    Rep Power
    0

    Default

    Nope, I am on Firefox. This is depressing.

  8. #8
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    Oh.
    I have to say I have no idea on this. A quick Google says <object> is a valid tag for Firefox.

Similar Threads

  1. Problem deploying applet to browser
    By nfteodoro in forum Java Applets
    Replies: 4
    Last Post: 09-25-2009, 11:03 AM
  2. Deploying Servlets
    By gapper in forum New To Java
    Replies: 2
    Last Post: 01-17-2008, 01:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •