Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Command Line Argument - Mode Flag

 
Seetharaman Iyer
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm bit confused with this statement. "
The mode flag must be either "server", indicating the server program must run, "alone", indicating standalone mode, or left out entirely, in which case the network client and gui must run.
"

Am I right on these?
1. We will be using same runme.jar to launch the application for three different mode(way) like one as server alone, and another as client alone and another one as client-cum-server (means process will do all the jobs)?

2. Just to check; when we pass,
a) "server" -> Only network server program should run - we have to launch client program separately using same runme.jar by not specifying anything in the mode flag; just by leaving it blank (either from different or same machine).

b) "alone" -> this type of launch will do both server side jobs as well as clients side jobs (means directly accessing DB file)

c) left blank -> Only network client program should run (i.e., GUI alone). Server must be started separately.

Thanks in advance,
Seetha...
 
Roel De Nijs
Sheriff
Posts: 9790
101
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No need to be confused, your remarks are spot-on

the same jar (runme.jar) is used to run the application in 3 different modes (depending on a single argument):
  • "server": starts the network server
  • "alone": starts the stand alone client application
  • (no argument): starts the network client application (which has to access the network server to make changes to the database file)
  •  
    Seetharaman Iyer
    Ranch Hand
    Posts: 35
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thank you so much Roel for your timely help. You are a champ
     
    Ed Ward
    Ranch Hand
    Posts: 147
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Follow up question: How to handle the situation where this is a first execution of the program (which means no properties file yet exists) and no argument is passed. If both the server and client apps are to startup (the client being in network mode), should we force the server to come up first before allowing the user to make use of the client gui?
     
    Seetharaman Iyer
    Ranch Hand
    Posts: 35
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Follow up question: How to handle the situation where this is a first execution of the program (which means no properties file yet exists) and no argument is passed. If both the server and client apps are to startup (the client being in network mode), should we force the server to come up first before allowing the user to make use of the client gui?

    It's not necessary. It's all upto us how we want the things to be working. In my case, no matters server is already started or not, client (networked) can be launched and run. I allow the user to change the server's ipaddress and port details while it's running. So the only time when the user wants to search (& Reserve) only, I need to connect to the server to get (reserve) the details. Rest of the time, it just can simply run. No matters whether server got crashed. This option also enable the user to connect to the different server (by specifying ipaddress and port).
     
    Roel De Nijs
    Sheriff
    Posts: 9790
    101
    AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Ed Ward wrote:If both the server and client apps are to startup (the client being in network mode), should we force the server to come up first before allowing the user to make use of the client gui?

    How are you planning to force the startup of a jar on any random computer (ip unknown to you) in the company network?

    Your network client just starts, dialog shows, user enters configuration settings (ip + port) and if no server application is found a message wille be shown: "server not running"
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic