Store application data, that can be used when i re-run the application?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AlarV
    New Member
    • Dec 2008
    • 37

    Store application data, that can be used when i re-run the application?

    The topic says it all, but I'll also say a few words here:

    I want to run a program many times and keep the data that I inserted every time. For example, if I create a person called Smith, this person should exist in the 2nd,3d,...n time I run the program. How do I do this?


    P.S. I don't need code, I just need the methods, or the libraries that I have to use to do this.

    Thanks in advance!
  • myusernotyours
    New Member
    • Nov 2007
    • 188

    #2
    You use a file or database. When you program is ran, it stores/writes/saves what you want in the file or database. The next time your program is ran, it reads what is in the file or database.
    If you don't know how to write data to a file or a database, you need to find that out.

    Kind Regards,

    Alex.

    Comment

    • AlarV
      New Member
      • Dec 2008
      • 37

      #3
      ok thnx.
      I don't have any clue on how to create a database in java, so I'll try the text file.
      Another question now: What kind of text file should I use? Cause I don't know anything of these, for example a google search gives me "binary text file" etc.

      Comment

      • myusernotyours
        New Member
        • Nov 2007
        • 188

        #4
        Read this

        Kind Regards,

        Alex.

        Comment

        • Markus
          Recognized Expert Expert
          • Jun 2007
          • 6092

          #5
          Use a database. There are many online resources for helping with database use in Java. The same goes for using flat-file databases (text files) in Java.

          When you've given it a try, post back here with a more specific problem and we'll help you from there.

          Mark.

          Comment

          • AlarV
            New Member
            • Dec 2008
            • 37

            #6
            Thanks for the replies. I checked the databases and as I don't know much about them, I decided to use the .txt method.

            I completed the .in part and now I have to implement the stuff that are printed by the program in the .txt file (outputStream part).

            Question: How do I reach the end of a .txt file to write new stuff in the .txt? I used the outputStream.pr intln("blah") and all I had saved in the .txt were replaced by "blah".

            Comment

            • AlarV
              New Member
              • Dec 2008
              • 37

              #7
              Ok thnx everyone for your help, I did what I asked for and after all it was easy :)

              Comment

              Working...