I was about to hand in my assignment until I noticed "server must start programatically". Fair enough the instructions do say the server MUST run when the runme.jar command is "server". BUT
they also say that if left blank the network client MUST run. Now how do you run the network without entering the host details? This step requires manual configuration and can not be avoided?
SCJP 6.0, SCJD (400/400), SCBCD for JEE 5, SCWCD 1.4 I do videos for development at
I am probably the only developer ever to have had an orange sized brain tumor in my brain while learning development!!
In my application this happens and i think that's what they expect (no manual editing of files, because that's not allowed):
If "java -jar runme.jar server" a window is shown with the appropriate configuration settings. if user enters these config settings and clicks on "start server" button the server is started.
If "java -jar runme.jar" a dialog is shown with the appropriate configuration settings. if user enters these config settings and clicks on connect, the main window application is shown (if the settings were valid of course)
If "java -jar runme.jar alone" a dialog is shown with the appropriate configuration settings. if user enters these config settings and clicks on connect, the main window application is shown (if the settings were valid of course)
Fair enough. But what is the Must requirement saying here? In Andrews book he states that the server must start programatically. This could be understood as "When the server command is provided your server must start immediately and must not require a databse location or or port number to be specified." The MUST requirement that states the server MUST run also indicates that the server must run right away.
The network client will then ofc use the default server port and any allowance for the port to be specified is redundant.
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.
My impression is that at that very moment the server is to be running once the command is entered. Any steps that require a database to be browsed for or a port number to be specified indicate that your server is "not" running as instructed.
Just to give you a position, my approach was exactly like what my good buddy Roel explained above. When running the server (with java -jar runme.jar server), just let the user provide the settings you think are necessary, and with that information, start your server. Also, after my server is started, I just print on the console a message, like, "Server running, press Ctrl + C to exit".
From your quote from the instructions: "the server program must run", so that's what happens. My server program runs, it shows a window where configuration settings can be entered and then the server starts when user hits the "start server" button.
so in my interpretation there is a difference between the server and the server program. and the server program is started when parameter server is passed as program argument.
starting the server can't be done without having the necessary configuration settings (what is the server port number, where is the database file). So if you want to start the server directly, then someone has to manually edit a file to set the correct port number and the database location). And that's not allowed according to this quote from the instructions
You must not require manual editing of any files by the examiners.
And the most important thing
Roberto Perillo wrote:
my approach was exactly like what my good buddy Roel explained above
and Roberto passed already, so it's a valid approach (my assignment is in grading process at this moment, still 4-5 weeks to go)