views:

95

answers:

3

Suppose you're short on time and you're looking for a program with certain features, and you find one, except it lacks one feature - it cannot save and load its state. Is it possible to achieve this on OS level, or with another program, that can take the whole thing, write it to a file, and then at a later time, load it back into memory? How?

Specifically for me, this is about a Java program, but any more information on this topic is welcome.

A: 

You want to do something like the Hibernate function of Windows right?

This will be extremely difficult to implement in Java as you will also have to write the state of the JavaVM. If you had open files when you closed the program end so on.

I think the best you can do is writing the objects you need to recover to disk using Java serialization.

Dave
Hibernate - I suppose. In this case, the program is pretty simple and doesn't have any opened files. Just its own state. Why should saving the state of JavaVM be a problem? Suppose you're only running this Java program.
quano
Well, the Java VM is loaded by your OS it is then the Java VM which loads your program. So you are looking for a program to load the JavaVM, let us call it MyJavaLoader, which loads the JavaVM which loads your program. Do you see the endless chain coming :-).
Dave
+5  A: 

One (heavy and easy) solution could be to use VirtualPC and install the program on a virtual OS.

Oops
Very clever! What would be your OS of choice for this case?
quano
of course that depends on your needs. The heavy part is: you need a complete OS-installation. Win7prof contains the WinXP-Mode. but I also have Windows Vista with Windows Vista in the VirtualPC. You need minimum 2GB Ram. Once installed everything, it works quite easy you decide to keep/save your changes or to delete everything
Oops
+1  A: 

Check these library's:-

  1. Brakes
  2. ACTC(Asynchronous Transfer of Control Threading) [Article]
  3. Apache JavaFlow
Emil