资讯   |   开发   |   选机中心   |   产品大全 | IBM | 惠普 | 联想 | 戴尔 | 苹果 | 神舟
更多: | 华硕 | 明基 | 方正 | 紫光 | TCL | 夏新 | 联宝 | 宏碁 | 七喜 | 长城 | 清华同方 | 海尔 | 三星 | 东芝 | 索尼 | 富士通 | LG | 技术 | ddnoon
当前位置:笔记本 > 软件开发 >
Advertisement
文章正文

applet做好了,但是执行不了(一个送分的问题,菜鸟学习第一天)

类型:转载   责任编辑:asp.net   日期:2007/05/23


热门软件下载:


   

import   java.applet.Applet;  
  import   java.awt.*;  
  public   class   welcomeapplet   extends   Applet  
  {  
      Label   textLabel;  
      public   void   init()  
      {  
    textLabel=new   Label("welcome   to   world   of   java!");  
    textLabel.setAlignment(Label.CENTER);  
    this.add(textLabel);  
  }  
  }  
   
  写了一个基本的applet,在jdk下javac编译通过,但是用java执行时,出错:  
  Exception   in   thread   "main"   java.lang.NosuchMethod   Error:main.  
   
 

网友回答:

发表者:gow

用java命令执行,没有main()方法呀,  
  要不然就嵌入到网页中执行。

发表者:zhongzuo1981

建一个文本文件,把下面的代码粘进去,把txt改为html  
  <applet   code="welcomeapplet.class"   width=300   height=300>  
  </applet>

发表者:xmbareheaded

applet要嵌入网页中才能看到!  
  <html>  
  <applet   code   ="welcomeapplet.class"   width="200"   height   =   "200"></applet>  
  </html>  
  写一个这样的html文件和你的类文件放在一个路径下面然后用打开这个网页就可以了!


 

 
热门推荐笔记本: TCL笔记本
相关文章:
笔记本相关:
IT技术文章:
webmaster:popbb@126.com   最佳浏览:1024X768 MSIE
©2007 popbb.net All Rights Reserved