简体   繁体   中英

Unable to run applet program in web browser but works fine in applet viewer?

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!!

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

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