-1

I wrote a simple application in Java by NetBeans. This application takes some strings and stores them in a list. All in a GUI (using Swing).

I would like that when I run file .jar and I store a string and then I close the application, I would like that when I reopen the application, the program shows me the strings stored before

How can I do? Thanks to all

Hovercraft Full Of Eels
  • 283,665
  • 25
  • 256
  • 373
Develobeer
  • 425
  • 1
  • 8
  • 19
  • 1
    Save the `String`; either to a file in the file-system or to a relational database. – Elliott Frisch Aug 31 '14 at 20:25
  • 1
    Your question tags include [tag:applet]. I don't know if this was a mistake, but if you're creating applets you may run into a whole bunch of problems when trying to write data to disk since this may violate Java security settings, especially if the applet is not a "trusted" applet. I would suggest that you not use applets for data output to disk. – Hovercraft Full Of Eels Aug 31 '14 at 20:28
  • Have you done _any_ research? One google search would have been enough. – Gumbo Aug 31 '14 at 20:30
  • You have any number options, have a look at this [discussion](http://stackoverflow.com/questions/19556932/how-to-save-the-state-of-my-minesweeper-game-and-then-load-it/19557052#19557052) for more ideas – MadProgrammer Aug 31 '14 at 20:35
  • Possible [duplicate](http://stackoverflow.com/q/8381954/230513). – trashgod Aug 31 '14 at 23:24

1 Answers1

2

I'm afraid you'd need to store the data into a file or a similar resource.

Take a look at How do I create a file and write to it in Java? for a how-to

Community
  • 1
  • 1
pikausp
  • 1,142
  • 11
  • 31