在web上运行java applet

时间:2015-12-10 04:18:51

标签: java applet java-web-start

我试图通过使用带有eclipse的tomcatserver 7.0来运行java applet作为web应用程序

applettest.java:

  package main;
  import java.applet.*;
  import java.awt.*;

 public class applettest extends Applet{
/**
 * 
 */
private static final long serialVersionUID = 2119308802277101723L;

public void paint(Graphics g){
  g.drawString("helloworld.",90,100);
  }
}

将其导出为jar文件并包含在html文件中

main.html中:

 <HTML>
 <HEAD>
 </HEAD>
 <BODY>
 <div >
 <APPLET CODE="applettest.class"  archive="/desktop/applettest/applettest.jar" WIDTH="800" HEIGHT="500">
 </APPLET>
 </div>
 </BODY>
 </HTML>

当我在谷歌浏览器浏览器上运行时,它给了我“不支持该插件”。然后我尝试在safari浏览器上运行,并将安全设置更改为允许java。它给了我以下错误:

      Plugin2Manager calling stopFailed() because of displayable window      sun.plugin2.main.client.PluginEmbeddedFrame[frame0,169,102,800x500,layout=java.awt.BorderLayout,title=,resizable,normal]
     Java Plug-in 11.66.2.17
     Using JRE version 1.8.0_66-b17 Java HotSpot(TM) 64-Bit Server VM
     User home directory = /Users/reem
     ----------------------------------------------------
     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>
     ----------------------------------------------------

如何解决此问题以便在网络上运行Java applet?

0 个答案:

没有答案