• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question About Packaging

 
Yanxin Zhao
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi: everyone.
should I write Runme.java to be main class of runme.jar to response DOS cammand? likes
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12007
215
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Yanxin Zhao

That should be fine.

Regards, Andrew
 
Yanxin Zhao
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12007
215
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Yanxin

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?

Regards, Andrew
 
mike acre
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Regards, Andrew


which begs the question, why are command line arguments not automatically interned?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic