To istall OpenJDK 17, use this command on Linux:
sudo apt install openjdk-17-jdk
After the installation is complete, you can verify that both the java runtime and the javac compiler are correctly installed.a Check the Java runtime version:
java --version
Check the Java compiler version:
javac --version
- Save the file: Make sure the code is saved in a file name 'SimpleQuizGame.java'
- Compile the code: Navigate to the directory where you saved the file and use the Java compiler (javac) to compile it into bytecode.
javac SimpleQuizGame.java
If there are no errors, this command will create a new file named 'SimpleQuizGame.class' in the same directory.
- Run the program: Now, you can run the compiled program using the Java Virtual Machine (java).
java SimpleQuizGame
The program will then execute in your terminal, and you can begin the quiz.
FROM openjdk:17-slim
WORKDIR /app
COPY . .
CMD ["java", "SimpleQuizGame"]
docker build -t simple-quiz-game-java:latest .
docker pull sc3p73r/simple-quiz-game-java:latest
docker run -it --name java-app simple-quiz-game-java:latest