I’m stuck on Stage #(Redis Respond to multiple PINGs).
I’ve tried executing the script file - ./spawn_redis_server.sh.
I get an error:Error: LinkageError occurred while loading main class Main
java.lang.UnsupportedClassVersionError: Main has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 61.0
Tried running javac main.java, but that did’nt help.
Checked the java version which is java 17
% java -version
java version “17.0.10” 2024-01-16 LTS
Java™ SE Runtime Environment (build 17.0.10+11-LTS-240)
Java HotSpot™ 64-Bit Server VM (build 17.0.10+11-LTS-240, mixed mode, sharing)
How to solve this issue.
And here’s a snippet of my code:
clientSocket = serverSocket.accept();
BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
while(true){
String line = in.readLine();
System.out.println(line);
if(line.equalsIgnoreCase("ping")){
clientSocket.getOutputStream().write("+PONG\r\n".getBytes());
}
}