• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

suncertify.properties

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I put the suncertify.properties file and suncertify package in runme.jar .
but when execute

>java -jar path\runme.jar

It shows could not find the suncertify.properties file in command line .
What should i do to deal with it ?
Thank you .
 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, sheng peng

In my instructions there is a "must" requirement, "...suncertify.properties which must be located in the current working directory.", so I didn't put the property file in the suncertify package or any other packages, instead, I make the program generate the file dynamically when a user runs it in his/her working directory. For example, the user runs the program using the following command line,

The property file will be created in the root directory of the C disk.
I hope this will help.

Regards, Ailsa Cape
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am quite sorry for register again . I have formatted my hardware and can not login . I am very sorry .

Ailsa , thank you very very much , or maybe i will failed in the exam .
I am not quite sure what is the current directory . Is it the directory i
run the jar file ?
Could you tell me how i can get the current directory and create a file-suncertify.properties file there . Thank you very much .
[ October 02, 2005: Message edited by: zhi peng ]
 
Ailsa Cape
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,zhi peng

The current working directory is the directory in which you run your program. In my example, it is the root directory of the C disk.
If you don't specify a peculiar directory and only use the file name when you create the properties file, you will establish it in the current working directory by default. You can write a temporary java file to test this section only and you will find the result.

Regards, Ailsa Cape
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
i have a related question. my requirements also mention a suncertify.properties file for storing configuration data. But what if my application doesnt require any configuration data? the only thing that is asked of the user is the location of the database, and that happens each time the program is run so that information doesnt need to be stored. Do i still need to generate this file because it is a must-have requirement? If so what would i put in it!?
Thanks
Chirag
 
author and jackaroo
Posts: 12200
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 Chirag,

Welcome to JavaRanch and this forum.

I would consider the database location an excellent item to store in the properties field.
  • If the user is working in "alone" mode, they do not need to browse to the database location each time they start up (assuming you allow browsing).
  • If the user is working in networked client mode, they do not need to enter the server's IP address (wouldn't that be annoying - trying to remember the IP address each time) or domain name.

  • And, if you allow the port to be changed, you might want to store that as well.

    In my system, I went overboard (as usual) and stored things such as the user's preferred window size as well.

    Regards, Andrew
     
    Chirag Patel
    Greenhorn
    Posts: 5
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thanks for clearing that up Andrew. Though i was hoping you weren't going to say that.. Otherwise i would've finished!
    I just have a couple more quick questions, no point starting a whole new topic:
    1. I have the B&S assignment and it says that 0x8000 implies that a record is deleted, or in other words, deleted records should be marked 0x8000, but whats the point of that? Shouldn't a deleted record be removed completely from the file? That would be inline with the requirement in the comments of the DB interface for the delete method:
    // Deletes a record, making the record number and associated disk
    // storage available for reuse.
    Im guessing this might be one of their intentional ambiguities but it seems here the instructions directly conflict with each other.

    2. I chose to use Sockets over RMI for the simple reason that i've never used RMI. Im guessing this is one if those major design decisions I might be asked to talk about in the exam or in the choices.txt file, but of course I can't say that i chose to use Sockets just because I don't know how to use RMI. Could you tell me of any good reasons why choosing Sockets would be better than using RMI?

    Thanks again for any help
    Chirag
     
    Andrew Monkhouse
    author and jackaroo
    Posts: 12200
    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 Chirag,

    It is generally a good idea to open new topics, as questions may get missed when tacked onto an existing topic. Plus it may confuse somebody coming in to look at a topic on suncertify.properties and finding these other questions. As you will see, the answers to your questions are not necessarily trivial, so they could each warrant a topic unto themselves.

    How would you be proposing to free the space used by the record?

    If you physically rewrite all the other records such that the space is recovered (the file gets smaller) then you are going to have problems with record numbers changing. That is, if client A reads record 5, then somebody deletes record 4 this will push record 5 up to the record 4 slot - if client A then tries to book record 5, you will have to somehow track which record they think they have and where it really is.

    I could carry on with other hypotheticals, but first I would like to hear your ideas on how you would handle this without using the delete flag - then we can discuss it merits and problems.

    I chose to use Sockets over RMI for the simple reason that i've never used RMI. Im guessing this is one if those major design decisions I might be asked to talk about in the exam or in the choices.txt file, but of course I can't say that i chose to use Sockets just because I don't know how to use RMI.

    All other things being equal, that is a reasonable decision to make . That is, if there is no specific reason to go for RMI or to go for Sockets, then going for the one you know best is a valid choice. However in order for you to be able to say that all other things are equal, you have to know what the pros and cons of each solution are.

    Could you tell me of any good reasons why choosing Sockets would be better than using RMI?

    I can tell you lots of reasons - in the book we wrote over 4 pages comparing and contrasting the two technologies. Might be a bit too much to be posting here though.

    I would recommend you do some searches in this forum, then post some of your ideas in a thread. Others can then add to them and possibly make comments if they feel that something is not stated strongly enough or if they feel that something is wrong. Phil Maquet (who used to be a bartender of this forum) was a big fan of Sockets, so searching for any topic containing both his member ID and the word Sockets will probably give you some useful topics to read.

    Regards, Andrew
     
    Chirag Patel
    Greenhorn
    Posts: 5
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hello again Andrew,
    Thanks for the prompt and lengthy reply! I appreciate this must take up quite alot of your free time. This is how my database works:

    First I read in the records into a Hashtable. If the record in the initial database file is marked as deleted it is ignored and not added. The keys to the Hashtable are the records numbers which are assigned in numerical order starting from zero, as each record is read. I have a getFreeIndex() method which searches the Hashtable for the smallest integer which has not yet been used as a key. I do not use the position of the record in the file to determine its record number.

    If a record is deleted the object is removed from the Hashtable, and that particular index becomes free. The record numbers for others records remain the same. The whole Hashtable is re-written to file whenever a change is made to the database (updates/deletions). This way, only valid records which have not been deleted are written to file. If records have been deleted the file size becomes smaller. Therefore the delete flag is not really needed, although I do take it into account (by ignoring it) in the initial reading in of the file, just in case the supplied database file happens to contain records marked as deleted.

    I hope i've explained my method clearly enough. Looking forward to your reply. Thanks.
    Chirag
     
    reply
      Bookmark Topic Watch Topic
    • New Topic