The classic Snake game implemented in Java with an attractive UI and smooth gameplay.
To play run the application in the Snake folder. Use the W,A,S,D keys to control the snake.
- W - Move Up
- A - Move Left
- S - Move Down
- D - Move Right
- There are also on-screen controls for pausing and restarting the game
- Ensure you have Java installed on your system
- Compile the source files:
javac -d out src/*.java - Run the compiled program:
java -cp out Game
-
Compile the Java code:
javac -d out src/*.java -
Create a JAR file:
mkdir -p out/META-INF echo "Main-Class: Game" > out/META-INF/MANIFEST.MF jar cvfm Snake.jar out/META-INF/MANIFEST.MF -C out .
-
Use jpackage (requires JDK 14+):
jpackage --input . --name Snake --main-jar Snake.jar --main-class Game --type exe --icon src/Snake.ico --win-console --dest dist
- Windows OS for the executable version
- Java Runtime Environment (JRE) 8 or higher for running from source
