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.
3 Replies
⌛ This post has been reserved for your question.
Hey @TGamerboy_02! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./closeor theClose Postbutton above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping.
Warning: abusing this will result in moderative actions taken against you.can you check on which variable it throws the error
i assume its on calling the send encrypted method
so just send variables like
if its an object just send null
and if not send the default value
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping.
Warning: abusing this will result in moderative actions taken against you.