1

applet program is just working fine applet viewer but when trying to run in browser it shows runtime exception java.lang.reflect.InvocationException and a window shows the following details

    Java Plug-in 10.7.2.11
    Using JRE version 1.7.0_07-b11 Java HotSpot(TM) Client VM
    User home directory = C:\Users\tom
    ----------------------------------------------------
    c:   clear console window
    f:   finalize objects on finalization queue
    g:   garbage collect
    h:   display this help message
    l:   dump classloader list
    m:   print memory usage
    o:   trigger logging
    q:   hide console
    r:   reload policy configuration
    s:   dump system and deployment properties
    t:   dump thread list
    v:   dump thread stack
    x:   clear classloader cache
    0-5: set trace level to <n>
    -----------------------------------------
    -----------

here is my html code for running applet

    <html>
    <body>
    <applet code="integrity.class" width="800" height="500">
    </applet>
    </body>
    </html>

help me fix this!!

1
  • Let's start with the fact that the applet tag is deprecated and move on from there. It would "seem" like you're missing the code base attribute, which is going to make it hard for the browser to know where to load your class from. Have a read through The APPLET Tag and Deploying an Applet Oct 5, 2012 at 6:14

1 Answer 1

0

You should set the code on your package path to your applet class, and the archive to the path of the jar, like this:

<applet code="my.applet.package.Integrity" archive="integrity.jar" width="800" height="500">

Also note that class names should start with uppercase in Java

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.