This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have a StartClient class that acts as a proxy between starting in local or remote mode. in local mode I start the client java -classpath . suncertify.client.StartClient local db.db In remote mode I start the client java -classapth . suncertify.client.StartClient remote <ipaddress> <port>. This adds the mode of connection to the command line is this going to lose me points and should I create a simple GUI to handle the connection mode ?
These command lines may only take configuration parameters selected from this list: DNS name of the server Port number used by the server Data file name(s) java.rmi.server.codebase security manager policy file
Taken from the specs. Ok on that note. it looks like in local mode you are using the db.db file in the root directory, or the directory you are running the java command from. Since this is the case and you probably put that in your readme.txt file that that is where it shoudl reside, then you can reduce your command line arguments to just IP address if you want Remote mode. What you will need to do is put the location of the db.db file in your code. Use System.getProperty("user.dir"); and append a "/db.db" to it to pass the location of the db file. Mark
Nigel, did you note that you can infer the mode simply from the number of command line arguments? (In fact, in my submission the port was optional; I simply used the File class to see if the specified database location existed as a file, if not, I would treat it as a hostname). Mark, I'm not sure I'm happy with the idea of hardwiring something like the file location in the code. The assignment allows you to specify it as a command line option, why not do that? - Peter
I did it that way because I knew the db.db file would be in the jar directory. I put that in the readme, and in the specs it states that you can move the db.db file wherever you want to. As long as the db.db file is where the jar file is, it will always work.
The suncertify/db directory in this distribution also contains your database file, "db.db". You may not modify this file, but you may move it if you wish.
This was in the readme part of the specs
The location of your db.db file.
I did not lose any points for this. plus by coding this in my code, I left out the "User" problems that occur if they put the wrong information in the command line. You know those wacky users. Mark Mark