当我尝试编译我的项目时,我收到了这个错误:
java.lang.NoClassDefFoundError: me/hansolox1/tetris/test
Caused by: java.lang.ClassNotFoundException: me.hansolox1.tetris.test
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Exception in thread "main"
但是在向项目添加真实代码之前,我删除了 me.hansolox1.tetris.test 类。这是我第一次看到这样的错误......请帮助!
编辑:
我已经删除了测试类,但是使用方法“main”的新类:
package me.hansolox1.tetris;
import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.StateBasedGame;
public class tetris extends StateBasedGame {
public static final int MAINMENU = 0;
public static final int TETRIS = 1;
public tetris(){
super("Tetris!");
}
@Override
public void initStatesList(GameContainer arg0) throws SlickException {
this.addState(new MainMenu(MAINMENU));
this.addState(new MainState(TETRIS));
}
public static void main(String[] args) throws SlickException{
AppGameContainer app = new AppGameContainer(new tetris());
app.setDisplayMode(800, 600, false);
app.start();
}
}
我正在使用 slick2d 引擎...
EDIT2:我也尝试过清理