Error: Main method not found in class Menu, please define the main method as:
public static void main(String[] args)
我总是得到那个错误,我试图把它放在代码中的任何地方,但它不会运行......我正在使用 Slick2D 作为菜单。
这是我的Menu
课程代码。
import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
public class Menu {
Image background = null;
Image startGameOption = null;
Image exitOption = null;
float startGameScale = 1;
float exitScale = 1; {
try {
background = new Image("Sprites/MenuBackground.gif");
} catch (SlickException e1) {
e1.printStackTrace();
}
// load the menu images
Image menuOptions;
try {
menuOptions = new Image("Sprites/MenuOptions.gif");
} catch (SlickException e) {
e.printStackTrace();
}
startGameOption = menuOptions.getSubImage(0, 0, 377, 71);
exitOption = menuOptions.getSubImage(0, 71, 377, 71);
}
}
我也在使用 Eclipse。不过,我永远无法让它停止给出该错误..这是我尝试运行Menu
课程时出现的唯一错误。我到处检查,它似乎并没有帮助我解决这个错误。