• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

question About Packaging

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi: everyone.
should I write Runme.java to be main class of runme.jar to response DOS cammand? likes
 
author and jackaroo
Posts: 12199
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 12199
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
I have always wanted to have a neighbor just like you - Fred Rogers. Tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic