简体   繁体   English

小程序未显示在浏览器中

[英]Applet does not display in browser

I am using a JApplet which have swing components in it and the event handling is done by AWT listeners. 我正在使用一个JApplet,它具有摇摆组件,并且事件处理是由AWT侦听器完成的。 My applet is fine when I run it in applet viewer but when I run it in my browser, it does not displays up only and empty space with message on top that: 当我在applet查看器中运行它时,我的applet很好,但是在浏览器中运行它时,它不会只显示空白,而是在顶部显示以下消息:

Error, Click for details 

Where could be the problem and how could I resolve it? 问题可能在哪里,我该如何解决?

The stack trace is : 堆栈跟踪为:

    java.lang.ClassNotFoundException: AudioApplet.class
    at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager.initAppletAdapter(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Here is the applet tag I used to embed my applet into HTML 这是我用来将applet嵌入HTML的applet标签

   <applet code="AudioApplet.class" width="700" height="700">
    Java applet that draws animated bubbles.
    </applet> 

these are the things you can correct/check: 这些是您可以纠正/检查的内容:

•Check the Java Console log for errors. •检查Java控制台日志中是否有错误。 •Check the syntax of the applet's Java Network Launch Protocol (JNLP) file. •检查小程序的Java网络启动协议(JNLP)文件的语法。 Incorrect JNLP files are the most common reason for failures without obvious errors. 错误的JNLP文件是没有明显错误的失败的最常见原因。 •Check the JavaScript syntax if deploying using the runApplet function of the Deployment Toolkit. •如果使用Deployment Toolkit的runApplet函数进行部署,请检查JavaScript语法。 See Deploying an Applet for details. 有关详细信息,请参见部署Applet。 Problem: The Java Console log displays java.lang.ClassNotFoundException. 问题:Java控制台日志显示java.lang.ClassNotFoundException。

•Make sure your Java source files compiled correctly. •确保正确编译了Java源文件。 •If deploying using the tag, check that the path to the applet JAR file is specified accurately in the archive attribute. •如果使用标签进行部署,请检查是否在归档属性中正确指定了applet JAR文件的路径。 •If launching using a JNLP file, check the path in the jar tag in the JNLP file. •如果使用JNLP文件启动,请检查JNLP文件中jar标记中的路径。 •Make sure the applet's JAR file, JNLP file, and web page are located in the correct directory and reference each other accurately. •确保小程序的JAR文件,JNLP文件和网页位于正确的目录中,并且彼此正确引用。 Problem: I was able to build the code once, but now the build fails even though there are no compilation errors. 问题:我曾经能够构建一次代码,但是即使没有编译错误,现在构建也会失败。

•Close your browser and run the build again. •关闭浏览器,然后再次运行构建。 The browser most likely has a lock on the JAR file, because of which the build process is unable to regenerate the JAR file. 浏览器很可能在JAR文件上具有锁定,因此构建过程无法重新生成JAR文件。 Problem: When I try to load a web page that has an applet, my browser redirects me to www.java.com without any warning 问题:当我尝试加载具有小程序的网页时,浏览器将我重定向到www.java.com,而没有任何警告

•The applet on the web page is most likely deployed using the Deployment Toolkit script. •网页上的applet最有可能是使用Deployment Toolkit脚本进行部署的。 The applet may require a later version of the Java Runtime Environment software than the version that currently exists on the client. 该小程序可能需要比客户端上当前存在的Java Runtime Environment软件更高的版本。 Check the minimumVersion parameter of the runApplet function in the applet's web page. 在小程序的网页中检查runApplet函数的minimumVersion参数。 See Deploying an Applet for details. 有关详细信息,请参见部署Applet。 Problem: I fixed some bugs and re-built my applet's source code. 问题:我修复了一些错误,并重新构建了applet的源代码。 When I reload the applet's web page, my fixes are not showing up. 当我重新加载小程序的网页时,未显示我的修复程序。

•You may be viewing a previously cached version of the applet. •您可能正在查看小程序的先前缓存版本。 Close the browser. 关闭浏览器。 Open the Java Control Panel and delete temporary internet files. 打开Java控制面板并删除Internet临时文件。 This will remove your applet from cache. 这将从缓存中删除您的applet。 Try viewing your applet again. 尝试再次查看小程序。

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

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