Redis: Respond to multiple PINGs

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());
          }
         } 

@sudhanshusharma21 Just checking, do you still need any assistance with this?

Thanks for the update, Yes need help with this.

@sudhanshusharma21 Could you upload your code to GitHub and share the link? It will be much easier to debug if I can run it directly.

Closing this thread due to inactivity. If you still need assistance, feel free to reopen or start a new discussion!

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.