1) You could write a custom format, evaluate the state and save to file. Then read that state when you reopen. 2) You can serialize the objects. See
Serializable (Java Platform SE 6)