Topic: applet无法在IE显示的问题

  Print this page

1.applet无法在IE显示的问题 Copy to clipboard
Posted by: aihao
Posted on: 2006-03-13 17:05

我刚刚学java
照着书本打了一些applet小程序,
通过appletviewer可以调试运行,
但去无法在IE中显示出来,
请问这是什么问题呢?
大家帮帮忙啊,
这使我很沮丧!

2.Re:applet无法在IE显示的问题 [Re: aihao] Copy to clipboard
Posted by: aihao
Posted on: 2006-03-13 17:07

现在给一个我照书写的代码和编辑好的class:
import java.awt.*;
import java.applet.Applet;

public class AppletHello extends Applet //每个Applet都需要继承Applet类
{
  String s;
  public void init(){
    String temps;
    temps=getParameter("name");
    s="everyone";
    if(temps!=null){
      s=temps;
    }
  }

  public void paint(Graphics g)
  {
    g.drawString("Hello,"+s,size().width/5,size().height/4);
  }
}

AppletHello.class (0.85k)

3.Re:applet无法在IE显示的问题 [Re: aihao] Copy to clipboard
Posted by: Skybus
Posted on: 2006-03-13 18:23

public void paint(Graphics g)
{
g.drawString("Hello,"+s,size().width/5,size().height/4);
}
}

It's bad habit to use such sentence . what's more ,you should post you html file so that we can see what's wrong

4.Re:applet无法在IE显示的问题 [Re: aihao] Copy to clipboard
Posted by: rr253
Posted on: 2006-03-13 20:55

不出大问题很可能是ie浏览器的问题
在appletviewer中可以观看吗???
可以的化那基本就是ie的问题了

5.Re:applet无法在IE显示的问题 [Re: rr253] Copy to clipboard
Posted by: aihao
Posted on: 2006-03-13 21:35

rr253 wrote:
不出大问题很可能是ie浏览器的问题
在appletviewer中可以观看吗???
可以的化那基本就是ie的问题了

IE浏览器没问题,我下载了一些applet的小程序,IE都可以显示.
我在appletviewer中可以观看啊!
我的htm是这样写的:
<html>
<head>
<title>
Applet 集
</title>
</head>
<body><div align=center>
<applet code="AppletHello.class" width="500" height="40">
<param name="name" value="hx">
</applet>
</div>
</body>
</html>
请大家指教!

6.Re:applet无法在IE显示的问题 [Re: Skybus] Copy to clipboard
Posted by: aihao
Posted on: 2006-03-13 21:45

Skybus wrote:
It's bad habit to use such sentence . what's more ,you should post you html file so that we can see what's wrong

Thank you for awaking me!
Your English is very good.
I sorry,my English is so bad.
So ,I feel difficult to commune with you!
And I don't know what 's wrong with the expression follow
"
g.drawString("Hello,"+s,size().width/5,size().height/4);

"
The expression is from a book about java.

7.Re:applet无法在IE显示的问题 [Re: aihao] Copy to clipboard
Posted by: Skybus
Posted on: 2006-03-13 23:56

The method size() in that expression is out of date for java 1.4 or higher! It's not recommendatory to use it!

{ from why: size() is deprecated in JDK 1.1, use getSize() instead. }

However, I think your java code and html file is normal and I have got a proper result with your code,can you get a right result using appletviewe command! alike: appletviewer htmlname.html

{ from why: Embaressed aihao had already mentioned twice that 通过appletviewer可以调试运行 and 我在appletviewer中可以观看啊! }

to why: I am very sorry for saying that ,Blush I appologize to aihao for it!

here is my code:

ApplerHello.zip (0.88k)

8.Re:applet无法在IE显示的问题 [Re: aihao] Copy to clipboard
Posted by: aihao
Posted on: 2006-03-14 12:46

Oh,I mentioned that "我在appletviewer中可以观看啊!" just for rr253.

Skybus,thanks for your code.
But it's the same as mine.
Have you try it in IE Explorer or other Explorer?
In my IE Explorer,it doesn't work.

9.Re:applet无法在IE显示的问题 [Re: aihao] Copy to clipboard
Posted by: Skybus
Posted on: 2006-03-14 13:14

I am sorry, it rather confuses me ,I works well in my IE Explorer.

10.Re:applet无法在IE显示的问题 [Re: aihao] Copy to clipboard
Posted by: aihao
Posted on: 2006-03-14 13:21

Oh,my god!
why can't mine.

11.Re:applet无法在IE显示的问题 [Re: aihao] Copy to clipboard
Posted by: aihao
Posted on: 2006-03-14 13:29

Skybus:
what edition of your javac?
I don't know why you can but my friend and me.

12.Re:applet无法在IE显示的问题 [Re: aihao] Copy to clipboard
Posted by: aihao
Posted on: 2006-03-14 13:32

IE 状态栏中显示:
load: class AppleHello not found.

13.Re:applet无法在IE显示的问题 [Re: aihao] Copy to clipboard
Posted by: aihao
Posted on: 2006-03-14 13:39

我想问一问,会不会是因为编译器的问题?
我装的是: j2sdk-1_4_2_10-nb-4_1-win-ml.exe
不知道与JDK的有什么不一样的呢?
刚刚接触,什么都不懂啊.
(I'm sorry I wrote it in Chinese.)

14.Re:applet无法在IE显示的问题 [Re: aihao] Copy to clipboard
Posted by: Skybus
Posted on: 2006-03-14 14:48

IE 状态栏中显示:
load: class AppleHello not found.

java代码生成的AppletHello.class文件是否与html文件在一个目录下面呢? 另外,请仔细检查一下html文件的内容看是否有错!

btw:你说你可以用appletviewer命令显示出正确结果就说明你的编译器是没有问题的,,你的ie可以显示其他的applet程序那就说明你的IE也是没有问题啊!

15.Re:applet无法在IE显示的问题 [Re: Skybus] Copy to clipboard
Posted by: rr253
Posted on: 2006-03-14 16:42

Skybus wrote:
java代码生成的AppletHello.class文件是否与html文件在一个目录下面呢? 另外,请仔细检查一下html文件的内容看是否有错!

btw:你说你可以用appletviewer命令显示出正确结果就说明你的编译器是没有问题的,,你的ie可以显示其他的applet程序那就说明你的IE也是没有问题啊!


ie能显示其他的不一定就是ie没有问题
因为ms对ie的java applet的支持没有升级
有可能在新的编译器下编译的有些applet是不能在ie中运行的

如果你装jdk的时候装了ie插件那个选项的化
在ie的工具internet选项高级中关于java的插件的选项勾选应该就可以解决了
我前段时间看书
书上有提到这个事情的

16.Re:applet无法在IE显示的问题 [Re: aihao] Copy to clipboard
Posted by: Skybus
Posted on: 2006-03-14 17:02

对 ,你说的对,看看aihao 的情况是怎样的了!

17.Re:applet无法在IE显示的问题 [Re: aihao] Copy to clipboard
Posted by: aihao
Posted on: 2006-03-14 17:13

IE选项中,高级的关于java的全部都钩选项了,
但还是不行,

还有一点问题就是,我和我同学用的是不同的java版本,

结果同样的代码,编译出来的class文件竟然占用的空间不一样大的.

好晕啊.

不好意思,刚刚放学回来,现在才回复

18.Re:applet无法在IE显示的问题 [Re: Skybus] Copy to clipboard
Posted by: aihao
Posted on: 2006-03-14 17:22

Skybus wrote:
java代码生成的AppletHello.class文件是否与html文件在一个目录下面呢? 另外,请仔细检查一下html文件的内容看是否有错!

btw:你说你可以用appletviewer命令显示出正确结果就说明你的编译器是没有问题的,,你的ie可以显示其他的applet程序那就说明你的IE也是没有问题啊!

都放在同一个文件夹的,我还以为是路径太长有问题,
后来把它放在D盘下,它仍然不行.
晕,
你编译的那个,我同学也看不了
我们都可以在appletviewer中看到.

19.Re:applet无法在IE显示的问题 [Re: aihao] Copy to clipboard
Posted by: aihao
Posted on: 2006-03-14 17:33

这是我下载的一个applet小程序,还有我自己的AppletHello还有运行的截图.

我真不知道怎么搞了.

ApplerHello.rar (48.77k)

20.Re:applet无法在IE显示的问题 [Re: aihao] Copy to clipboard
Posted by: aihao
Posted on: 2006-03-14 17:33

截图如下:

(缩略图,点击图片链接看原图)

21.Re:applet无法在IE显示的问题 [Re: aihao] Copy to clipboard
Posted by: Skybus
Posted on: 2006-03-14 18:21

你不要用遨游,直接用ie打开试试看,附件里面有我的截图!

ApplerHello.rar (40.34k)

22.Re:applet无法在IE显示的问题 [Re: aihao] Copy to clipboard
Posted by: aihao
Posted on: 2006-03-14 18:32

Oh,my god.

The result is the same.

class :class AppleHello not found

could you view the class I uploap?

23.Re:applet无法在IE显示的问题 [Re: aihao] Copy to clipboard
Posted by: aihao
Posted on: 2006-03-14 18:51

I recompile the code.
And I found the class you compiled occupy 0.874kb,but mine occupy 0.872kb.

The class you compiled has some error when runs in my appletviewer,
and I cut a picture as follow:

24.Re:applet无法在IE显示的问题 [Re: aihao] Copy to clipboard
Posted by: aihao
Posted on: 2006-03-14 18:53

C:\Documents and Settings\寒星\桌面\ApplerHello\ApplerHello>appletviewer.exe AppletHello.html
java.lang.UnsupportedClassVersionError: AppletHello (Unsupported major.minor ver
sion 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
3)
at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:157)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:123)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:561)
at sun.applet.AppletPanel.createApplet(AppletPanel.java:619)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:548)
at sun.applet.AppletPanel.run(AppletPanel.java:299)
at java.lang.Thread.run(Thread.java:534)

25.Re:applet无法在IE显示的问题 [Re: aihao] Copy to clipboard
Posted by: aihao
Posted on: 2006-03-14 18:54

what's it mean the sentence "java.lang.UnsupportedClassVersionError: AppletHello (Unsupported major.minor version 49.0)"

26.Re:applet无法在IE显示的问题 [Re: aihao] Copy to clipboard
Posted by: aihao
Posted on: 2006-03-14 18:55

好像是说版本不支持什么的!

27.Re:applet无法在IE显示的问题 [Re: aihao] Copy to clipboard
Posted by: why
Posted on: 2006-03-14 19:22

1. Please try to use the editing feature of this forum rather than posting more short replies within a short period of time.

2. Seems to me that you have an older version of Java in the path, show us your path setting
(you may want to uninstall all JDKMoon, restart your computer, an reinstall the JDK.)

28.Re:applet无法在IE显示的问题 [Re: aihao] Copy to clipboard
Posted by: aihao
Posted on: 2006-03-14 20:46

我删了原来的j2sdk
重新装了j2sdk-1_4_2_10-nb-4_1-win-ml
结果还是一样.


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923