0

I'm receiving an error while trying to run a multi-command window server application. I'm compiling both the Client and Server with the -cp "commons-lang3-3.10.jar" file, but I continue to run into this Exception. I've attached a link to an image of the error. The program runs at first and waits to accept a client connection..., but then when I open a second command window and run my ChatClient, I get the error. I'm currently using an Ubuntu virtual machine.

https://i.stack.imgur.com/zcvOx.jpg

John Herwig
  • 39
  • 1
  • 8
  • Please provide a SSCCE. Why do you use "-cp commons-lang3-3.10.jar" to compile but "-cp ." to run com.muc.ServerMain? I advise you to learn how to use other options and arguments of javac and java in order to compile from the root directory of your project: https://gouessej.wordpress.com/2020/04/05/javafx-et-jogl-fonctionnent-ensemble-javafx-and-jogl-work-together/#commandlineinterface – gouessej Apr 07 '20 at 22:08
  • Without using the "-cp ." to run, the program doesn't run. https://imgur.com/a/v8dDIWW – John Herwig Apr 07 '20 at 22:17
  • Why not entering "java -cp commons-lang3-3.10.jar:. com.muc.ServerMain"? Replace : by ; if you're under Windows. – gouessej Apr 07 '20 at 22:24
  • Your classpath needs to contain your dependencies and your own class files. – gouessej Apr 07 '20 at 22:25
  • that worked! thanks – John Herwig Apr 07 '20 at 22:27
  • You're welcome. If I were you, I'd put the .class files into a separate directory and I'd use "-d". In my example, I use "target/classes" as it's the expected layout when using Maven. I assume that you're a beginner. Learn to do things right from the start :) The main class must always be the very last argument when using "java". – gouessej Apr 07 '20 at 22:30

0 Answers0