Can';我的java小程序无法运行NoClassDefFoundError

Can';我的java小程序无法运行NoClassDefFoundError,java,netbeans,applet,Java,Netbeans,Applet,我试图让小程序工作,但它拒绝。下面是小程序的代码 <html> <head> <title>GAME!</title> </head> <body> <h1>GAME BY SID</h1> <hr> <applet code=GameManager.class width=240 height=300> al

我试图让小程序工作,但它拒绝。下面是小程序的代码

<html>
  <head>
      <title>GAME!</title>
  </head>
  <body>
      <h1>GAME BY SID</h1>
      <hr>
      <applet code=GameManager.class width=240 height=300>
    alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
    Your browser is completely ignoring the &lt;APPLET&gt; tag!
      </applet>
      <hr>
  </body>
</html>

游戏
希德的游戏

alt=“您的浏览器理解小程序标记,但由于某种原因,没有运行小程序。” 您的浏览器完全忽略小程序标记!
下面是GameManager的代码

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package alienLanding;

import java.awt.*;
import java.applet.*;
import java.net.MalformedURLException;
import java.net.URL;
/**
 *
 * @author Admin
 */
public class GameManager extends Applet implements Runnable{
    private int width;
    private int height;
    private Graphics offscreen;
    private Thread animation;
    private Image image;

    private GunManager gm;
    private UFOManager um;

    private Image gunImage;
    private Image ufoImages[];
    private Image[] attackImages;
    private Image[] explodeImages;

    private AudioClip explosionSound;

    private static final int REFRESH_RATE=80;
    @Override
    public void init(){
        showStatus(">>Initializing<<");

        width=bounds().width;
        height=bounds().height;
        setBackground(Color.black);        
        image=createImage(width,height);
        offscreen=image.getGraphics();
        loadImages();

        um=new UFOManager(width,height,ufoImages,attackImages,explodeImages,this,explosionSound);
        gm=new GunManager(width,height,gunImage,this,um.getUFOs());
        um.intialize(gm);
    }
    private void loadImages(){
        MediaTracker t=new MediaTracker(this);
        try{
            URL baseURL;
            URL gunURL;
            //G:\EBOOKS\Java Game Programming\CD\BOOK\chap06
            baseURL=new URL("file:///C:/ShortenedURLProgramming/ch06/");
            gunURL=new URL(baseURL,"image/gun.gif");

            gunImage=getImage(gunURL);
            t.addImage(gunImage,0);

            ufoImages=new Image[6];
            URL UFOImageURL;
            for(int i=0;i<ufoImages.length;++i){              
                UFOImageURL=new URL(baseURL,"image/ufo"+i+".gif");
                ufoImages[i]=getImage(UFOImageURL);
                t.addImage(ufoImages[i],0);
            }

            attackImages=new Image[6];
            URL attackImageURL;
            for(int i=0;i<attackImages.length;++i){
                attackImageURL=new URL(baseURL,"image/attack"+i+".gif");
                attackImages[i]=getImage(attackImageURL);
                t.addImage(attackImages[i],0);
            }

            explodeImages=new Image[4];
            URL explodeImageURL;
            for(int i=0;i<explodeImages.length;++i){
                explodeImageURL=new URL(baseURL,"image/explode"+i+".gif");
                explodeImages[i]=getImage(explodeImageURL);
                t.addImage(explodeImages[i],0);
            }

            URL explosionSoundURL=new URL(baseURL,"Explosion.au");
            try{
                explosionSound=getAudioClip(explosionSoundURL);
            }catch(Exception e){
                System.err.println("Could not load sounds.");
            }
        }catch(MalformedURLException e){
            System.err.println("Incorrect URL. Could not load images, and / or explosion sound.");
            System.exit(1);
        }

        try{
            t.waitForAll();
        }catch(InterruptedException e){

        }

        if(t.isErrorAny()){
            System.err.println(">>Media tracker error.<<");
           // System.exit(1);
        }else if(t.checkAll()){
           showStatus(">>Successfully loaded images.<<");
        }
    }
    @Override
    public boolean mouseMove(Event e,int x,int y){
        gm.moveGun(x);
        return true;
    }
    @Override
    public boolean mouseDrag(Event e,int x,int y){
        gm.moveGun(x);
        return true;
    }
    @Override
    public boolean mouseUp(Event e,int x,int y){
        gm.fireMissile(x);
        return true;
    }
    @Override
    public void update(Graphics g){
        paint(g);
    }
    private void updateManagers(){
        gm.update();
        um.update();
    }
    @Override
    public void paint(Graphics g){
        offscreen.setColor(Color.black);
        offscreen.fillRect(0,0,width,height);
        gm.paint(offscreen);
        um.paint(offscreen);

        g.drawImage(image,0,0,this);
    }
    @Override
    public void start(){
        showStatus(">>Game starting<<");
        animation=new Thread(this);
        if(animation!=null){
            animation.start();
        }
    }
    @Override
    public void stop(){
        showStatus("Game stopped");
        if(animation!=null){
            animation.stop();
            animation=null;
        }
    }
    @Override
    public void run(){
        while(true){
            repaint();
            updateManagers();
            Thread.currentThread().yield();
            try{
                Thread.sleep(REFRESH_RATE);
            }catch(InterruptedException e){}
        }
    }
}
/*
*要更改此模板,请选择工具|模板
*然后在编辑器中打开模板。
*/
包装校准;
导入java.awt.*;
导入java.applet.*;
导入java.net.MalformedURLException;
导入java.net.URL;
/**
*
*@author-Admin
*/
公共类GameManager扩展小程序实现可运行{
私有整数宽度;
私人内部高度;
屏幕外的私人图形;
私有线程动画;
私有图像;
私人枪械经理总经理;
私人UFOManager um;
私人形象;
私人图像ufoImages[];
私有映像[]攻击映像;
私密图像【】私密图像;
私人音频剪辑爆炸声;
专用静态最终整数刷新率=80;
@凌驾
公共void init(){
showStatus(“>>初始化媒体跟踪器错误。已成功加载图像。游戏开始更改此设置

code=GameManager.class

并确保类文件位于名为
alienLanding
的子文件夹中,以便与包匹配。

1)为什么要编写小程序?如果是因为老师指定了它,请参考它们。2)为什么要使用AWT?有关放弃使用组件的AWT以支持Swing的许多好理由,请参阅。
code=alienLanding.GameManager.class