信心大减,一个Applet的HelloWorld问题...救救我吧.(100分)

  • 主题发起人 主题发起人 iamfish
  • 开始时间 开始时间
I

iamfish

Unregistered / Unconfirmed
GUEST, unregistred user!
写过一点点Java Application,也没怎么遇过难题.这两天想写点Applet,即遇到这样的问题,已经两天了.
写了一个HelloWord的小Applet.编译成功,用AppletViewer查看也成功,但在网页中就是"Load: Class GetURL no found."
查看IE的缓存,有GetURL.class文件.
JDK 是:j2sdk1.4.1_01
我用JCreator2.5编译.也有试过用Javac编译,都不行.运行Java Application可以.查看网上其它的Applet也可以.
___________________________________________________
GetULR.java
___________________________________________________
import java.awt.*;
import java.applet.*;

public class GetURL extends Applet {

public void init() {
}
public void paint(Graphics g) {
g.drawString("Welcome to Java!!", 50, 60 );
}
}
___________________________________________________
GetULR.htm
___________________________________________________
<html>
<title>Test</title>
<head></head>
<body>
<applet cabbase="." code="GetURL.class" height="300" width="300" alt="Applet" mayscript="A" name="AP">test</applet>
</body>
</html>

测试:
http://www.chaoshan.com/lazyboy/java/GetURL.htm
下载
http://www.chaoshan.com/lazyboy/java/GetURL.rar
大家帮想一下是什么问题吧.是不是JSDK的问题?
 
你的文件名搞错了。
GetURL.class---->GetULR.class
 
可以运行呀。
你把http://127.0.0.1:20013/java 去掉,HTM 和 CLASS 文件放在同一个目录,试一试
 
我搞定了,主要是J2SDK1.4的HTML的写法,不能用Applet标记.
<html>
<head>
<title>Hello world</title>
</head>
<body>
<hr>
<!--"CONVERTED_APPLET"-->
<!-- HTML CONVERTER -->
<OBJECT
classid = "clsid:CAFEEFAC-0014-0001-0001-ABCDEFFEDCBA"
codebase = "http://java.sun.com/products/plugin/autodl/jinstall-1_4_1_01-windows-i586.cab#Version=1,4,1,1"
WIDTH = 300 HEIGHT = 100 >
<PARAM NAME = CODE VALUE = "Blink.class" >
<PARAM NAME = "type" VALUE = "application/x-java-applet;jpi-version=1.4.1_01">
<PARAM NAME = "scriptable" VALUE = "false">
<PARAM NAME = lbl VALUE="This is the next best thing to sliced bread! Toas
t, toast, toast, butter, jam, toast, marmite, toast.">
<PARAM NAME = speed VALUE="4">
<COMMENT>
<EMBED
type = "application/x-java-applet;jpi-version=1.4.1_01"
CODE = "Blink.class"
WIDTH = 300
HEIGHT = 100
lbl ="This is the next best thing to sliced bread! Toas
t, toast, toast, butter, jam, toast, marmite, toast."
speed ="4"
scriptable = false
pluginspage = "http://java.sun.com/products/plugin/index.html#download">
<NOEMBED>
alt="Your browser understands the &amp;lt;APPLET&amp;gt;
tag but isn't runni
ng the applet, for some reason."
Your browser is completely ignoring the &amp;lt;APPLET&amp;gt;
tag!
</NOEMBED>
</EMBED>
</COMMENT>
</OBJECT>
<hr>
</body>
</html>
 
贴错HTML了.
<OBJECT
classid = "clsid:CAFEEFAC-0014-0001-0001-ABCDEFFEDCBA"
codebase = "http://java.sun.com/products/plugin/autodl/jinstall-1_4_1_01-windows-i586.cab#Version=1,4,1,1"
WIDTH = 300 HEIGHT = 100 >
<PARAM NAME = CODE VALUE = "GetURL.class" >
<PARAM NAME = "type" VALUE = "application/x-java-applet;jpi-version=1.4.1_01">
<PARAM NAME = "scriptable" VALUE = "false">
<PARAM NAME = lbl VALUE="This is the next best thing to sliced bread! Toas
t, toast, toast, butter, jam, toast, marmite, toast.">
<PARAM NAME = speed VALUE="4">
<COMMENT>
<EMBED
type = "application/x-java-applet;jpi-version=1.4.1_01"
CODE = "GetURL.class"
WIDTH = 300
HEIGHT = 100
lbl ="This is the next best thing to sliced bread! Toas
t, toast, toast, butter, jam, toast, marmite, toast."
speed ="4"
scriptable = false
pluginspage = "http://java.sun.com/products/plugin/index.html#download">
<NOEMBED>
alt="Your browser understands the &amp;lt;APPLET&amp;gt;
tag but isn't runni
ng the applet, for some reason."
Your browser is completely ignoring the &amp;lt;APPLET&amp;gt;
tag!
</NOEMBED>
</EMBED>
</COMMENT>
</OBJECT>
 
版主,答案我已经自己找到了,也公布了答案,这个分我能否要回?
 
接受答案了.
 
to 楼主:
soory:(
刚才没有给分成功,再次结束的时候却结错了,
实在抱歉,
请到:
http://www.delphibbs.com/delphibbs/dispq.asp?lid=2443739
谢谢!!!
 
向lnboy至敬。
那150分我真的不敢去接。不好意思啊。你还是自己收回吧。在网上我还没看过像你这样的版主呢。
如果可以,希望能交你这样的朋友。
yztink@163.com
QQ:59219588
你的那个贴我就不去了。
:)
 
to iamfish:
是我操作失误,赔偿是应该的啊。
也希望能够多参与论坛的java版块,让java版块繁荣起来。
我的Email是:ln_boy@263.sina.com,欢迎交流。
 
后退
顶部