Hai, This is my package structure. And I have this inside ' myjava ' folder. suncertify\db All files given by the Sun plus LocalDataImpl suncertify\server Connection and Factory files plus the interfaces (connection and factory) suncertify\client DataClient and my UI I try to run my program like this: c:\>set classpath=c:\myjava\ c:\>java suncertify.server.FacImpl <host> <port> The server is started and it runs... But when I try to run it from any other directory (even from 'myjava'), c:\someOtherDir>java suncertify.server.FacImpl <host> <port> it says: "Data:Request to open a non-existant or inaccessible file db.db" Please tell me if there's some mistake in my classpath setting or package structure. Thanks Nandini
Discipline, Dedication and Determination define Destiny.
Hello Nandini Sounds to me like you are using a relative path to your file somewhere. If you have the access to your db.db file like this somewhere: String path = "suncertify/db/db.db"; Then, as far as I recall, it means "/FromWhereIStartTheProgram/" + path, not where the file using the path is. So starting is from anywhere else than the root directory of the app, as you speak about, will prefix your path with that dir. In which case the server of cource can't find your DB file. Just stating in the readme that the server must be started from the appropriate directory should solve this. Of course there are also better solution, but to be honest, I have not reached that part of the assignment yet. And it's been to long since I used File's for me to remember. Anyone? ;o) Regards, Flemming Mertz
Hi Nandini & Flemming, I agree with Flemming as to the probable cause.
[Flemming] Just stating in the readme that the server must be started from the appropriate directory should solve this.
Sounds like a nice simple solution.
Of course there are also better solution ...
Well, there are more user friendly solutions, and more complex solutions. But whether they are "better" is a difficult decision One solution might be to allow the user to specify the location of the database file, possibly by using a file chooser. Another option: As long as the user used my executable jar file, I could look at the class path and determine where my jar file was, and from there I could make a reasonable guess at where the database file was likely to be. I then presented that as the default location to the user. Very user fiendly. But way overkill for the project Regards, Andrew