我写了一个applet,用myEclipse运行没问题。然后我把它嵌到个网页中,用命令提示符运行appletviewer就出现了警告,请大家帮忙看下问题在哪里。警告: <embed> 标记需要代码属性。
Exception in thread "main" java.lang.NullPointerException
at sun.applet.AppletViewer.parse(AppletViewer.java:1111)
at sun.applet.AppletViewer.parse(AppletViewer.java:1056)
at sun.applet.Main.run(Main.java:138)
at sun.applet.Main.main(Main.java:80)
html中的xml如下:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>MyHtml.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">--> </head>
<body>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="800" height="150" id="GUI" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="GUI.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="GUI.swf" quality="high" bgcolor="#ffffff" width="800" height="150" name="GUI" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
<applet code="GUI.class" align="middle" width="800" height="500">
</applet>
</body>
</html>
Exception in thread "main" java.lang.NullPointerException
at sun.applet.AppletViewer.parse(AppletViewer.java:1111)
at sun.applet.AppletViewer.parse(AppletViewer.java:1056)
at sun.applet.Main.run(Main.java:138)
at sun.applet.Main.main(Main.java:80)
html中的xml如下:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>MyHtml.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">--> </head>
<body>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="800" height="150" id="GUI" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="GUI.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="GUI.swf" quality="high" bgcolor="#ffffff" width="800" height="150" name="GUI" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
<applet code="GUI.class" align="middle" width="800" height="500">
</applet>
</body>
</html>
要求embed标签code属性
如果把applet标签往上移呢 多试试吧
我太菜了,请指教