将你的Clock1.java文件改名为Clock.java

解决方案 »

  1.   

    不行啊,改了还是不行,对了,是不是有Thread的Applet编译后都是生成类名$线程名?如本例的Clock$showtsck.class
      

  2.   

    import java.awt.*;
        import java.util.*;
        import java.applet.*;
        import java.net.*;
        import java.lang.*;public class Clock extends Applet implements Runnable
               {long t1,t2,t3;
                String timeString;
                int h,m,s;
                boolean bz=true;
                URL url1,url2,url;
                URLConnection con;
                Date Stime,Ctime;//定义变量
                
                showtsck tsck=new showtsck();
                
                public void init()
                     {   
                        int kssj=Integer.parseInt(getParameter("kssj"));//获得所传递的考试时间
                         
                        h=kssj/60;m=kssj%60;//将所获得的考试时间转换为h小时和m分钟
                        
                              try{url=new URL("http://127.0.0.1:8080");
                         
                                  con=url.openConnection();//与服务器相连                               t1=con.getDate();//获得登录时的服务器的时间
                                  }
                              catch(Exception e){}                    Stime=new Date(t1);//由登录时服务器的时间生成一个DATA对象                    Ctime=new Date(Stime.getYear(),Stime.getMonth(),Stime.getDay(),h,m,0);
                                           //由登录时服务器的年月日及考试时间对应的时,分和0秒
                                           //生成DATA对象,它用来生成倒计时的初始值   
                        
                        t2=Ctime.getTime();//以它为基值减去所用的时间便可获得当前的倒计时
                     }           public void run()
                    
                      { 
                        while (bz)  {
                                      try {
                                             con=url.openConnection();t3=con.getDate();
                           
                                             Ctime=new Date(t2-t3+t1);
                                          }
                           
                                      catch(Exception e){}
                          
                                      h=Ctime.getHours();
                                      m=Ctime.getMinutes();
                                      s=Ctime.getSeconds();
                         
                                      timeString=Integer.toString(h)+":"+Integer.toString(m)+":"+Integer.toString(s);
          
                                      try {
                                            Thread.sleep(500);
                                          }
     
                                      catch(InterruptedException e){}
                                   
                                      this.showStatus("倒计时:"+timeString);
           
                                      if (h==0&&m==5&&s==0)
                                         tsck.start();                                  if (h==0&&m==0&&s==0)
                                         { bz=false;
                                           try
                                           {
                                           url2=new URL("http://127.0.0.1:8080///examples/jump.jsp");
                                           }
                                           catch(Exception e){}                                       getAppletContext().showDocument(url2);
                                         }
                                    }
                      }class showtsck extends Thread
            
              {  public void run()
                
                    {
                       Frame tsck=new Frame("时间提示窗口");
                       tsck.setSize(200,80);
                       tsck.add(new Label("考试时间还剩5分钟!"));
                       tsck.show();
        
                       try {
                             Thread.sleep(5000);
                           }
                       catch(InterruptedException e){}
        
                       tsck.hide();
                    }
               } 

      

  3.   

    1.你的classPath是不是没有写全
    2.不是string,是String