简体   繁体   English

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

[英]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 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>
    -----------------------------------------
    -----------

here is my html code for running applet 这是我运行小程序的html代码

    <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类,并将归档文件设置为jar的路径,如下所示:

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

Also note that class names should start with uppercase in Java 另请注意,在Java中,类名应以大写字母开头

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM