无法在Web浏览器中运行applet程序,但在applet查看器中工作正常吗?

时间:2012-10-05 06:03:10

标签: java html browser applet

applet程序只是运行良好的applet查看器,但在尝试在浏览器中运行时,它显示运行时异常 java.lang.reflect.InvocationException ,并且窗口显示以下详细信息

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

这是我运行applet的html代码

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

帮我解决这个问题!!

1 个答案:

答案 0 :(得分:0)

您应该将包路径上的代码设置为applet类,将存档设置为jar的路径,如下所示:

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

另请注意,类名称应以Java中的大写字母开头