Thanks for your reply. But, what should I do if I do not use such code? is it necessary in my application? I am not sure how to response this command "java -jar runme.jar server/client/alone". In fact, I just want to konw how to deal with which command without any extra code?
You will need to have some code like that somewhere in your application, as your application must accept the command line parameter telling it what mode to run in.
You might want to consider how you would complete this assignment if you were allowed to have seperate server and client applications. In such a case, you might have a standalone Server class with it's own main() method, and you might have a Client class with it's own main() method. You could then call those methods directly from within your RunMe class:
The RunMe class then becomes just a small wrapper to call your Server and Client.
By the way - I missed commenting on the use of "==" in your String comparisons in the first section of code. You do know why you should not use that operator, don't you?
Originally posted by Andrew Monkhouse: By the way - I missed commenting on the use of "==" in your String comparisons in the first section of code. You do know why you should not use that operator, don't you?
which begs the question, why are command line arguments not automatically interned?
SCJP 1.4, SCJD
I have always wanted to have a neighbor just like you - Fred Rogers. Tiny ad: