aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes question About Packaging Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "question About Packaging" Watch "question About Packaging" New topic
Author

question About Packaging

Yanxin Zhao
Ranch Hand

Joined: May 05, 2004
Posts: 65
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

Joined: Mar 28, 2003
Posts: 11503
    
  95

Hi Yanxin Zhao

That should be fine.

Regards, Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Yanxin Zhao
Ranch Hand

Joined: May 05, 2004
Posts: 65
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

Joined: Mar 28, 2003
Posts: 11503
    
  95

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

Joined: Sep 23, 2003
Posts: 197
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?


SCJP 1.4, SCJD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: question About Packaging