TGamerboy_02
TGamerboy_02
JCHJava Community | Help. Code. Learn.
Created by TGamerboy_02 on 2/20/2025 in #java-help
Problems in a Cryptography assignment problem
I've shared 3 files which I'm using for the assignment, which are Client.java, Server.java & RSAKeyGen.java. Upon running the command for Client, I get this persistent error: java Client.java localhost 6800 Harish Harish Enter command (ls, get filename, bye): ls Error: class [Ljava.lang.String; cannot be cast to class java.lang.String ([Ljava.lang.String; and java.lang.String are in module java.base of loader 'bootstrap') java.lang.ClassCastException: class [Ljava.lang.String; cannot be cast to class java.lang.String ([Ljava.lang.String; and java.lang.String are in module java.base of loader 'bootstrap') at Client.main(Client.java:63) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:569) at jdk.compiler/com.sun.tools.javac.launcher.Main.execute(Main.java:419) at jdk.compiler/com.sun.tools.javac.launcher.Main.run(Main.java:192) at jdk.compiler/com.sun.tools.javac.launcher.Main.main(Main.java:132) This is what I see on the server command tab: hpp6@xanthus:~/hp_java/msc_adv_java_hp/src$ java Server.java 6800 Server started on port 6800 Client connected from /127.0.0.1 Extracted client ID: Harish Client authenticated: Harish Client authenticated: Harish Received command from Harish: ls Client disconnected unexpectedly. I also want to let you guys know that I used Gen AI for generating the code, so I don't know what's going on every step of the program. Thanks in advance.
10 replies