So I'm trying to build a 2D game of snake, and I'm almost done. My only issue is that when I try to run the program, I get tis error:
"Exception in thread "main" java.lang.NoClassDefFoundError: Snake (wrong name: snake2/Snake)"
Usually it's just because I'm the the wrong directory or because I typed in the command wrong, but those reasons don't really seem to be the issue. The class with the main method is here: (the logic and 99% of the code is in a second class, also in package snake2)
package snake2;
import javax.swing.JFrame;
public class Snake extends JFrame {
public Snake() {
add(new Board());
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(320, 340);
setLocationRelativeTo(null);
setTitle("Snake");
setResizable(false);
setVisible(true);
}
public static void main(String[] args) {
new Snake();
}
}