LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1140|回复: 3

运行JAVA时候出现问题?

[复制链接]
发表于 2006-6-25 00:55:15 | 显示全部楼层 |阅读模式
我编译这个程序时候通过了没问题,为什么运行时候出现问题啊???
各位高手帮忙了,在此多谢。
[root@localhost java]# java Example
Exception in thread "main" java.lang.NoSuchMethodError: main
源程序:
import java.applet.*;import java.awt.*;
public class Example extends Applet
{
        public void init()
        {
                setBackground(Color.yellow);
        }
        public void paint(Graphics g)
        {
                g.setColor(Color.red);
                g.fillOval(10,10,100,100);
                g.clearRect(40,40,40,40);
        }
}
发表于 2006-6-25 17:13:39 | 显示全部楼层
Applet is a little bit different from Application, you should use "appletviewer".

First of all, you have to write a html file, which invokes the complied class file, for example:

<!-- Example.html -->
<applet code="Example.class" width=200 height=200>
</applet>


And then, run "appletviewer Example.html"
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-6-26 00:24:02 | 显示全部楼层
我是在LINUX下运行的,
运行其他带有Applet包则没有问题哦!!
回复 支持 反对

使用道具 举报

发表于 2006-6-28 14:12:59 | 显示全部楼层
没有main方法
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表